which: Example
1
1 5 Example
1 *********
1
1 The recommended way to use this utility is by adding an alias (C shell)
1 or shell function (Bourne shell) for 'which' like the following:
1
1 [ba]sh:
1
1 which ()
1 {
1 (alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@
1 }
1 export -f which
1
1 [t]csh:
1
1 alias which 'alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
1
1 This will print the readable ~/ and ./ when starting which from your
1 prompt, while still printing the full path when used from a script:
1
1 > which q2
1 ~/bin/q2
1 > echo `which q2`
1 /home/carlo/bin/q2
1