title: How to delete every character after a space?
body: <p>I am making a script that creates a backup of my <code>/home/</code> directory called <code>backup.sh</code>. When the backup completes I want the script to spit out the size of the backup in megabytes. Here are the lines I am having trouble with:</p>
  
  <pre><code># creates an approximate size of the file + the file location
  backup_text=$(du $new_backup)
  # take off the file name at the end and add an 'M' to specify Megabytes
  backup_text=${backup_text%[:blank:]*}M 
  # print string to console
  echo $backup_text
  </code></pre>
  
  <p>Here is the output I keep getting:</p>
  
  <pre><code>20 /backups/Thu_Aug_22_15:52M
  </code></pre>
  
  <p>As you can see, the backup size is 20M, which is correct, but the <code>/backups/...</code> part remains. What did I do wrong in my script?</p>
  
  <p>Sorry, probably a noob question, just starting scripting =)</p>