How To Preserve Line Breaks When Storing Command Output To A Shell Variable
erics, July 14th, 2021
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