This script checks all the directories in $PATH for accessibility, then it checks specific named arguments for possible conflicts between different directories in the $PATH. If no arguments are named, all programs in the $PATH are examined for conflicts.
Directories which are equivalent (symlinks) are removed from the list before the file analysis is made, to cut down on spurious conflicts. Apparent conflicts which are symlinks to the same file are also not reported. Most systems seem to have many of these.
This cannot get all possible conflicts for all shells and all situations. Specifically, it does not address shell aliases, built-ins or global shell functions, all of which are shell-dependant. Nor can it address temporary conflicts caused by a startup script which augments $PATH and then spawns child processes which perform a $PATH search.
Warning: A path element containing "~" is not valid in sh/ksh, but is valid in bash and some csh/tcsh. Normally the "~" is expanded when the path is set. We test (with "-d") for the presence of a directory and this fails because "~" is not expanded inside the test operation. In bash, the test fails, the "~" still works as a path element. It is most reliable to use $HOME explicitly, not "~", in $PATH
Options:
Exit status:
0 = all directories in PATH are accessible.
>0 = a count of the inaccessible directories.
(the exit status does not reflect whether pathname conflicts were discovered)
2004/11/03 Richard Brittain, Dartmouth College Computing Services.
Last update: 2009/02/07