I'm trying to build a small text file on-the-fly with bash. It has several lines, each one ending with a newline character.
So far I have:
Code:
[root@F10]# LINE1="This is line 1"
[root@F10]# LINE2="This is line 2"
[root@F10]# LINE3="This is line 3"
[root@F10]#
[root@F10]# FILE="${LINE1}${LINE2}${LINE3}"
[root@F10]# echo $FILE
This is line 1This is line 2This is line 3
[root@F10]#
[root@F10]# FILE="${LINE1}"\n"${LINE2}"\n"${LINE3}"
[root@F10]# echo $FILE
This is line 1nThis is line 2nThis is line 3
I can't get the \n newline characters onto the end of the lines. Am I missing something?
I want the output to look like:
Code:
This is line 1
This is line 2
This is line 3