My script contains something like this:

ifc=$(ifconfig)

With this, the ifc variable contains the output of the command ifconfig but without newlines. So, when I print it with echo $ifc I get only one line.

How can I include the newlines of subcommands?

link|improve this question

50% accept rate
feedback

1 Answer

up vote 6 down vote accepted

The correct way to print is

echo "$ifc"
link|improve this answer
oh! that easy... thanks :-) – Ethan Leroy Oct 1 '10 at 9:12
feedback

Your Answer

 
or
required, but never shown

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