title: bash create dir with sequential numbers
body: <p>I am creating a script to run on OS X which will be run often by a novice user, and so want to protect a directory structure by creating a fresh one each time with an n+1 over the last:</p>
  
  <p><code>target001</code> with the next run creating <code>target002</code></p>
  
  <p>I have so far: </p>
  
  <pre><code>lastDir=$(find /tmp/target* | tail -1 | cut -c 6-)
  let n=$n+1
  mkdir "$lastDir""$n"
  </code></pre>
  
  <p>However, the math isn't working here.</p>