title: Get the newest directory to a variable in Bash
body: <p>I would like to find the newest sub directory in a directory and save the result to variable in bash.</p>
  
  <p>Something like this:</p>
  
  <pre><code>ls -t /backups | head -1 &gt; $BACKUPDIR
  </code></pre>
  
  <p>Can anyone help?</p>