Please do NOT use "/bin/test" as a command name

Doug Gwyn <gwyn> gwyn at brl-tgr.ARPA
Wed Dec 11 01:31:09 AEST 1985


I have to disagree with Ian on this one.
Because you never know what kind of weird $PATH
people will be using, it is essential when
writing shell scripts for use by others to
FORCE the correct commands to be used in
your shell script, in order to guarantee
that the script does what you intended.
The simplest way to do this is to just set
PATH=whatever at the front of the script.
Besides being less trouble than using absolute
pathnames, this also handles problems like:
Is "sort" in /bin or /usr/bin (or /usr/5bin)?

The internals of a utility are subject to change.
You can't even reasonably make the user
responsible for looking inside utilities to see
whether they will work in conjunction with his
$PATH.  As far as a user should be concerned, a
utility should be a "black box" that does its job
reliably and without fuss.  If you're going to
make a utility reliable, its internal operation
should be protected against environmental factors
except when they are a deliberate part of the
interface.  If someone has his own "rm" command
(some of our users do), how do you know that it
is suitable for use in your script to remove a
link?  The answer is, you don't.



More information about the Comp.unix.wizards mailing list