bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bash needs builtin 'which' command


From: Paul Jarc
Subject: Re: bash needs builtin 'which' command
Date: 27 Mar 2001 17:42:37 -0500
User-agent: Gnus/5.090001 (Oort Gnus v0.01) Emacs/20.7

Dan Jacobson <jidanni@kimo.FiXcomTHiS.tw> writes:
> $ which true
> /bin/true
> but that's not what gets called by
> $ true
> etc. etc.

"which foo" isn't supposed to tell you what "foo" is; that's what
"type foo" is for.  "which foo" does exactly what it's supposed to do:
it tells you where foo is in $PATH.  If that isn't the information
you're looking for, simply don't use "which".

> It seems that the only way to get 'which' to know about bash
> builtins is to make it a builtin itself [in addition to, not
> replacement for, /usr/bin/which, etc.]

Right.  But "which" isn't supposed to know about builtins.

> That seems to be the right way to get it to give the correct answer

The correct answer depends on the question.  "which" answers one
question correctly, and another one incorrectly.  So it's best to ask
it the first question, but not the second.


paul



reply via email to

[Prev in Thread] Current Thread [Next in Thread]