8
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?
Works! Why, though? – Armand – 2013-04-08T11:22:23.570
see Word Splitting in
bash(1)
, you need quoting to preserve the spaces, tabs, or newlines. – livibetter – 2013-04-08T14:30:52.703