Fixes $dotfiles detection in a better way

Prior attempt broke if the shell was started from a directory other than
$HOME.  So, since OSX doesn't support the `-f` argument to readlink,
simulate it in a different way.  relative_readlink takes two arguments:
$dir = base directory, $base = filename within that directory.

If `greadlink` is installed (from homebrew's coreutils), use it
directly.

Otherwise, starting from the base directory, it runs readlink on $base.
If that returns an absolute path, use its dirname.  If it's a relative
link, try to `cd` into its dirname and find the absolute path from
there.