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 |
![]() |
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 |
Leave Your Comment
All fields marked with "*" are required.