Fix to work with Mac OS X (=> BSD)

- Script shebang was linked to /bin/sh; where the script was written in
  bash. Though most *nix OSs link bash to sh, not all do.

- The `readlink` command does not have a -m flag on Mac or BSD; used a
  combination of `cd` and `pwd -P` to remedy the issue.