1

I've symlinked a script file into my ~/bin, and when I do which foo the output is:

/Users/me/bin/foo

Is there a way to have this resolve the symlink and show me the real file?

joachim
  • 7,687

2 Answers2

4

use readlink

readlink -f "$(which command)"
tso
  • 156
3

With zsh:

print -r =foo(:A)

Or if foo is in the $cmd variable:

print -r $cmd:c:A