Please do NOT use "/bin/test" as a command name
Ian F. Darwin
ian at utcs.uucp
Mon Dec 9 07:55:16 AEST 1985
In article <1016 at sdcsla.UUCP> west at sdcsla.UUCP (Larry West) writes:
>However, I would like to point out that users have a habit
>of naming programs "test", and of having "/bin" occur late
>in their paths. This tends to cause confusion because the
>problem (as usual) doesn't come up until that brief "test"
>program has been forgotten.
>
>So, my suggestion is to always use "/bin/test" instead
>of simply "test", or else use "[ ]". I know, fixing
>the particular pathname of a program is a bad idea, but this
>seems a fairly safe case (unless you plan to provide an
>improved user interface to "test":-).
No, no, no. Do not use absolute paths for test, mv, cp, or
anything else. Least of all in shell files.
Sure, once in a while a new user will make a program called `test'
and get confused. Some people even do it twice (I did). Most
people don't do it a third time.
Note that the problem only comes up if you have your `test'
program in your $HOME/bin (what you call your private bin directory)
OR if you are in the same directory where you made that long-forgotten
test program.
On the other hand, if you post even a single shell file with /bin/test
in it, your `error' will be repeated hundreds of times all over the world.
Why is it an error? I call it an error because it violates the
portability principle: UNIX uses the PATH environment variable
to find programs, rather than making the user specify full path names
for programs. This allows you to write your own. Why would anybody
want to mv test out of /bin? Well, what if somebody decides that
test is used so often that it belongs in the shell? Then you have
to keep two versions of test around -- a fast one inside the shell,
and a slow one for `erroneuos' shell files. Oh, you say that they already
did this in some release of System V? My, what a surprise.
I'm equally against the practice of putting /bin/rm, /bin/mv, etc
into shell files. Please use rm, mv, etc, rather than the full paths.
You don't know what might motivate me to have my own version of rm
(indeed, you probably don't want to know what motivates me :=!). Please use
the facilities that UNIX provides. Don't negate UNIX's wonderful generality
for the benefit of a few nanoseconds.
Ian Darwin
Toronto, Canada
More information about the Comp.unix.wizards
mailing list