You can use cat command with input-output redirection operators (> >> <) and End of file (EOF) operator to append multiple lines to a file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
## cat command Input/Output redirection cat myfile1.txt > mynewfile ## creates a new file with the content of myfile1.txt cat mynewfile cat myfile2.txt >> mynewfile ## appends the content of myfile2.txt in mynewfile cat mynewfile cat < mynewfile ## redirects cat input with mynewfile content ## cat command with EOF and Input/Output redirection cat < hello world welcome to cloudaffaire EOF cat mynewfile cat < hello world welcome to cloudaffaire EOF cat mynewfile ## cat command with EOF and Input/Output redirection with variable cat < hello $USER welcome to cloudaffaire EOF cat mynewfile cat <<"EOF" > mynewfile hello $USER welcome to cloudaffaire EOF cat mynewfile rm my* |