2
I am making a Shell Script, and I have to record a lot of lines in a single file, how can I do this more automatically? 'Cause 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
Is it possible to put all lines 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 these lines that will be recorded, getting more like this:
variavel1=primeira
variavel2=segunda
variavel3=terceira
echo "$variavel1 linha
$variavel2 linha
$variavel3 linha
quarta linha
" >> /diretorio/arquivo.txt
I’ve searched everywhere, but I can’t find anything related to that.
It would be nice to say what the command
cat
makes or posts a link with the explanation– absentia