You are not logged in.
Greetings,
I want to echo a string to a terminal in a bash script which contains the output of a command which gives multiple lines if executed in bash. Sadly the linebreaks are lost. How can I preserve them?
command output is
line one
line two
My script looks like
...
string=`command`
...
echo $string
...
script output is
line one line two
Thanks!
Viv
edit: Ok, I'm stupid. I can just execute the command where I need its output. Now script is a bit inconsistent but it works.
Last edited by V for Vivian (2009-08-28 19:03:47)
YES WE CAN
(but that doesn't necessarily mean we're going to)
Offline
quoting the variable when echoing it might help. I did this little test:
$ tempvar="hi there
> ho there"
$ echo $tempvar
hi there ho there
$ echo "$tempvar"
hi there
ho there
$
Offline