Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to copy multiple lines (splitted by Enter key) from, for example, notepad and then paste it into new variable in CMD or Bash console and after that do some operations on it.

Although it's quite easy in PowerShell (I simply type

variable_name="

then paste copied lines and simply add

"

at the end) in predecessor it's much more complicated since CMD interpret each enter as "execute". Is there any other way to accomplish it, instead of save as external text file?

share|improve this question
1  
cmd and bash are fundamentally different here...it might be better to split the question, because I'd bet for bash it's enough to escape (with a backslash) the linebreaks. –  Bobby Jun 5 '12 at 9:04
2  
Bash console should work the same way as PowerShell. I'd just use ' instead of " to avoid expansion. –  choroba Jun 5 '12 at 9:20
add comment

1 Answer

Postfix each line with a \ to indicate multiple lines. Answered on Stack Overflow (although it probably doesn't even belong there.)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.