If I get the result of a command on a variable, how can I print this output with new lines. Silly example:
XX=$(ls -l); echo $XX
When I execute the above sentence, I have one line ilegible result instead of a formatted return as I saw when ls -l
is executed on a terminal. Is there any way to get the result of a command formatted or to display it's result with newlines?
printf
is better thanecho
. Read http://unix.stackexchange.com/questions/65803/why-is-printf-better-than-echo/65819#65819. – cuonglm Dec 01 '14 at 01:29