I'm doing a Shell Script, and I have to write a lot of lines in a single file, how can I do it in a more automatic way? Well I started doing it in a very manual way:
echo "primeira linha do arquivo" >> /diretorio/arquivo.txt
echo "segunda linha do arquivo" >> /diretorio/arquivo.txt
Can I put all rows in a single command? Example:
echo "primeira linha
segunda linha
terceira linha
quarta linha
" >> /diretorio/arquivo.txt
But there is something else, I have some variables in my script that I need to be putting in those lines where they will be written, getting more like this:
variavel1=primeira
variavel2=segunda
variavel3=terceira
echo "$variavel1 linha
$variavel2 linha
$variavel3 linha
quarta linha
" >> /diretorio/arquivo.txt
I've looked everywhere, but I have not found anything related to it.