bash script add line to end of file code example
Example 1: add a line at the end of a file linux
echo 'text here' >> filename
Example 2: add line to beginning of file shell script
$ sed -i '1s/^/added text /' file
echo 'text here' >> filename
$ sed -i '1s/^/added text /' file