title: Get the latest file in directory
body: <p>I need to get the latest directory name in a folder which start with nlb. </p>
  
  <pre><code>#!/bin/sh
  
  cd /home/ashot/checkout
  dirname=`ls -t nlb* | head -1`
  echo $dirname
  </code></pre>
  
  <p>When the folder contains many folders with name starting nlb, this script works fine, but
  when there is only one folder with name starting nlb, this script prints the latest file name inside that folder. How to change it to get the latest directory name?</p>