Subject: Re: which(1) is a csh script?
To: Roland Dowdeswell <email@example.com>
From: David Laight <firstname.lastname@example.org>
Date: 10/07/2003 08:21:21
On Mon, Oct 06, 2003 at 05:35:38PM -0400, Roland Dowdeswell wrote:
> On 1065475161 seconds since the Beginning of the UNIX epoch
> "Jesper Louis Andersen" wrote:
> >I was amazed to find that which(1) is a csh script. It makes it rather
> >hard to rely on it when searching for things in a $PATH variable,
> >since csh as far as I can see sources $path instead and doesnt merge
> >$PATH into it (and you are using ksh).
> If you are using ksh, then you should be using the ksh builtin
> whence. It does the right thing.
For a Posix conformant 'sh' (which should include ksh and netbsd's sh)
'command -v name' or 'comamnd -V name' should work.
'which' is a csh builtin/script - so is rather pointless!
'type' is the traditional 'sh' way of finding out where/what a comamnd
is, and should work for most non-csh shells. Posix defined 'command -v'
because the output of 'type' was too system dependant.
'whence' is a ksh'ism that isn't in the Posix standard.
David Laight: email@example.com