views:

2976

answers:

1

I've got a script 'myscript' that contains the following:

abc
def
ghi

in another script, I call:

declare RESULT=$(./myscript)

and $RESULT gets the value

abc def ghi

Is there a way to store the result either with the newlines, or with '\n' character so I can output it with 'echo -e'?

+12  A: 

Actually, RESULT contains what you want - to demonstrate:

echo "$RESULT"

What you show is what you get from:

echo $RESULT
Jonathan Leffler
Ah, ha! I'm an idiot!Thanks much for the speedy reply. Serves me right to be working this late...
Parker
Jonathan, good catch. +1 :)
Johannes Schaub - litb
...1 1/2 months later, and thanks to SO's "related questions" feature, the answer to my question before I posted it. Thanks!
DevSolar