How can I get the behavior of GNU's readlink -f on a Mac?
问题 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 ...] 回答1: readlink -f does two things: It iterates along a sequence of symlinks until it finds an actual file. It returns that file's canonicalized name—i.e., its absolute pathname. If