It must be soooo simple, but all of the examples that I found after a few hours of googling don't work, as the mail is always attached to the file instead of writing it into the body. I don't want to send empty messages either, but want to send mail only when I have output from the script. Here is my command:
$script_file > /tmp/output.log ; mail -E -s "Output subject" "my@emailaddress" < /tmp/output.log ; rm -f /tmp/output.log
Would it be possible to change this command to force the mail to embed the content of the output.log file?
My system is CentOS.
Many thanks!
$script_file | mail -E -s "Output subject" "my@emailaddress"