I'd like to send output of multiple commands as attachments and with modern system and mailx I'd prefer to skip uuencode and use simply -a switch, all inline. But no matter what combinations I tried I am not able to make this work.
Of course it works to redirect outputs into text files first and send those but that's not what I am looking for.
( ls -l ~ | uuencode att0.txt; ls -l /tmp | uuencode att1.txt) | mailx -s "ls" someone@somewhere.org
This used to work with older environments but it is very outdated, and modern implementations do not properly understand uuencode, prefering MIME, and turn that into body.
Fixed:
( echo "Subject: ls"; ls -l ~ | uuencode att0.txt; ls -l /tmp | uuencode att1.txt) | sendmail someone@somewhere.org
Ugly, but working. What you can do.