I was wondering if there is a built-in command in Bash (or even something OSX-specific) that would display the fully resolved path of a script that is in the current PATH
environment variable.
For example, my PATH
currently looks like this:
>: echo $PATH | tr ":" "\n"
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
/opt/X11/bin
/Users/Josh/Dropbox/Scripts/Bash
/Users/Josh/Dropbox/Tools/WinRAR/OSX
And there's a script in Dropbox called get-azurelogs.sh
. That path is in my PATH
variable for convenience, but if I wanted to display the complete path to that script, assuming I wasn't sure where it was, is there an simple one-liner way to display the fully resolved path instead of testing it at each of the directories above?
Best Answer
You can use
which
. From the man page: