On Linux, the readlink
utility accepts an option -f
that follows additional links. This doesn't seem to work on Mac and possibly BSD based systems. What would the equivalent be?
Here's some debug information:
$ which readlink; readlink -f
/usr/bin/readlink
readlink: illegal option -f
usage: readlink [-n] [file ...]
MacPorts and Homebrew provide a coreutils package containing greadlink
(GNU readlink). Credit to Michael Kallweitt post in mackb.com.
brew install coreutils
greadlink -f file.txt