Using the following script it will find all version of a command in $PATH (from Unix Power Tools)
$ cat /tmp/whereiz
#!/bin/sh
testx=”test -x”
fixpath=”`echo $PATH | sed \
-e 's/^:/.:/' \
-e 's/::/:.:/g' \
-e 's/:$/:./'`”
# echo $fixpath
IFS=”: ”
for command
do
where=””
for direc in $fixpath
do $testx $direc/$command && where=”$where $direc/$command”
done
case “$where” in
?*) echo $where ;;
esac
done
Example
$ /tmp/whereiz ls grep
/bin/ls /tmp/ls
/bin/grep