I have a bash script that needs to do this:
1) Run a external command and store the output either in variable or tempfile.
2) Add the output as a body in a mail with the mail-command.
The mail body needs to contain static text both before and after the output from the external command which excludes the solution to pipe it directly by
external-command | mail
I have tried this:
1) Storing output of external-command in a variable by running
and creating another variable that contains static text+variable+static text and run
echo($anothervariable) | mail
2) pipeing the external-command output to a tempfile and do
(cat pretext; cat tempfile; cat posttext) | mail ...
Both my solutions above gives me a mail without line breaks with makes it unusable.
Please advice how to send my text with proper line breaks.