OS X bash: dirname OS X bash: dirname bash bash

OS X bash: dirname


What about:

cd "$(dirname "$0")"

That works for me here.


#!/bin/shcd "$(dirname "$0")"


What finally worked for me is changing this:

#!/bin/shcd `dirname $0`

To this:

#! /bin/zshcd "${0:h}"

This also supports file names and file paths containing spaces. Here's where I found it: http://rentzsch.com/unix/locationAwareCommandFiles