readlink.sh
is a pure shell implementation that uses dirname
, basename
, readlink
and pwd
utils.
Note that you cannot rename it to just readlink
as then the script will call itself instead of the system utility.
realpath
script simply calls Python's os.path.realpath
.
Python is provided in OS X and major Linux distributions.
You can use instead of the system utility by making a symlink: ln -s realpath readlink
.
Another way is to install coreutils
package via Homebrew or MacPorts and use greadlink
.
The code is taken from the following page on StackOverflow: http://goo.gl/Yw9OY