How To Preserve Line Breaks When Storing Command Output To A Shell Variable

Solution: “Double Quote” your variables!
1 2 3 4 5 6 7 8 9 10 11 |
shell> myvar="abc def ghi" shell> echo $myvar abc def ghi shell> echo "$myvar" abc def ghi |
See Also: https://stackoverflow.com/questions/22101778/how-to-preserve-line-breaks-when-storing-command-output-to-a-variable