title: Bash Script pipe multiple commands to one email
body: <p>I wanna write the output of various commands as an email.
  I tried this:</p>
  
  <pre><code>#!/bin/bash
  
  (echo $(date); echo $(top);sudo apt-get update &amp;&amp; sudo apt-get upgrade -y)  | mail -s "Updated!" xxxxxxxxxxx@gmail.com -a "From: UpdateNotify&lt;xxxxxxxx@gmail.com&gt;";
  </code></pre>
  
  <p>The script is infinite. :/</p>
  
  <p>How can I do that? I need the date,top output and the update logs in one email.</p>