I wanna write the output of various commands as an email. I tried this:
#!/bin/bash
(echo $(date); echo $(top);sudo apt-get update && sudo apt-get upgrade -y) | mail -s "Updated!" [email protected] -a "From: UpdateNotify<[email protected]>";
The script is infinite. :/
How can I do that? I need the date,top output and the update logs in one email.