title: How to create a temporary directory?
body: <p>I use to create a <code>tempfile</code>, delete it and recreate it as a directory:</p>
  <pre><code>temp=`tempfile`
  rm -f $temp
    # &lt;breakpoint&gt;
  mkdir $temp
  </code></pre>
  <p>The problem is, when it runs to the <em>&lt;breakpoint&gt;</em>, there happens to be another program wants to do the same thing, which <em>mkdir</em>-ed a temp dir with the same name, will cause the failure of this program.</p>