In a script, I need to send the contents of two separate Linux commands in one email. I understand that I can append the outputs of the two commands to a file and send that file as an attachment. However, the script will also be run by other users so they may not have permission to view/edit/send this files. Therefore, I was wondering if there is a way to directly send the outputs of two different commands in one email.
Asked
Active
Viewed 47 times
0
-
Do you know how to send the output of a single command? How do you do it? – Kamil Maciorowski Jun 25 '21 at 17:27
-
1If you're using `bash`: [Use command grouping](https://www.gnu.org/software/bash/manual/html_node/Command-Grouping.html), then pipe to your mail solution – Panki Jun 25 '21 at 17:28
-
@KamilMaciorowski Yes, I would do command | mail -s ... – Yash Jun 25 '21 at 19:20