title: atomic create file if not exists from bash script
body: <p>In system call <code>open()</code>, if I open with <code>O_CREAT | O_EXCL</code>, the system call ensures that the file will only be created if it does not exist. The atomicity is guaranteed by the system call. Is there a similar way to create a file in an atomic fashion from a bash script?</p>
  
  <p>UPDATE:
  I found two different atomic ways</p>
  
  <ol>
  <li>Use  set -o noclobber. Then you can use > operator atomically.</li>
  <li>Just use mkdir. Mkdir is atomic</li>
  </ol>