I would like to output results in latex table format using a bash script. However, when I want to add a newline symbol, bash either prints it (\n) or doesn't add a newline. I already tried several things (e.g. the ones mentioned https://superuser.com/questions/154936/echo-text-with-new-line-in-bash), but nothing seems to work. What am I doing wrong?
echo "$(cat $outputFile)$latexString" > $outputFile echo "\\\\" >> $outputFile echo "" >> $outputFile
$latexString is the line of the table I want to save,
\\ is the EOF for the line in the table, and after that I want to have a newline.
EDIT The output file should look like:
res1 & 1 & 2 & 3 & 4 \\ res2 & 5 & 6 & 7 & 8 \\ ...
'latexString' is then e.g.,
res1 & 1 & 2 & 3 & 4