( GNU bash, version 4.2.50(1)-release (powerpc-ibm-aix6.1.2.0))
(
echo "a"
echo "b"
echo "c"
)| sendmail -F "Sender" recipients@a.com
This runs inside a .sh file, and the log (when ran with the -x option) show the sendmail
before echo "c"
.
I am trying to debug why sendmail fails sporadically. Since the subshell and sendmail run in parallel, is it possible for sendmail to not wait for the whole subshell to be over, and use only the partial output until echo b
and proceed to send an incomplete email and then fail? (There are no error messages in stderr though, the email just doesn't show up in my inbox mysteriously for some executions)
For more context: The echo commands I wrote above are just placeholders, I am actually trying to prepare an email as in this answer https://stackoverflow.com/a/3335377/11521011 and pipe it to sendmail