On Nov 11, 2011 5:39 PM, "Andrew Spiers" <7andrew@gmail.com> wrote:
>
> I couldn't  google for this. How do I preserve line breaks when
> assigning the result of something to a variable?
>
> aspiers@cape:~/tmp/horror$ ls -1
> file1
> file2
> file3
> aspiers@cape:~/tmp/horror$ echo -e $(ls -1)
> file1 file2 file3
>
> There must be something better than this:
>
> aspiers@cape:~/tmp/horror$ echo -e $(ls -1| awk '{print $0,"\\n"}')
> file1
>  file2
>  file3

Does this help?

# export IFS="
"

Note that you need to hit enter after the first double quote.

Marcus