Subject: Re: bin/3138: [dM] mkdep(1) always uses /usr/bin/gcc
To: Todd Vierling <email@example.com>
From: Chris G. Demetriou <firstname.lastname@example.org>
Date: 02/01/1997 15:31:13
> Funny; I don't see why. If you're worried about security, that's one thing
> (a root user should know his $PATH--this isn't setuid); if you're worried
> about compatibility, there should be no problem using which. The binary
> /usr/bin/which (which sh uses, instead of csh's builtin) works as this
> script uses it; if it finds cc/gcc, it prints only the first instance, and
> if it doesn't, it prints nothing.
"what christos already said."
Also, note that /usr/bin/which is not "a binary" it's a csh script,
with all of the nasty features that christos described.
If you're actually using it from sh, you're probably doing the wrong
thing; it can and will mislead you.
Why is it this way? because that's the way it's always been, or
something. I dunno. However, that doesn't change the fact that it
_is_ that way, not only on NetBSD but on many/most other UN*X-ish
In my opinion, the 'right' solution for this case, if path searching
is desired, is to check the path component by component for the
searched-for file name.