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
  comibination of `cd` and `pwd -P` to remady the issue.