title: Bash script absolute path with OS X
body: <p>I am trying to obtain the absolute path to the currently running script on OS&nbsp;X.</p>
  
  <p>I saw many replies going for <code>readlink -f $0</code>. However since OS X's <code>readlink</code> is the same as BSD's, it just doesn't work (it works with GNU's version).</p>
  
  <p>Is there an out-of-the-box solution to this?</p>