Bob Proulx wrote:
Bojan Land wrote:
Do you know which shells do not have type and thus rely on which?
I wouldn't guess that *any* shell "relies" on 'which'... probably all
shells have built-in $PATH lookup, but may not expose it to the user in
the way bash's 'type' does.
As far as I know there is no portable way to get this information. It
is impossible to determine this information portably without writing a
portable shell script and including it in the application needing this
information.
Right; if you need the output of 'type', the safest way I know of is to
roll your own function in portable shell script.
Traditional Unix machines used a csh script /usr/bin/which to search a
defined set of system paths. Newer ksh used 'whence'. Bash uses 'type'.
XSI extensions to POSIX require 'command -v'. Debian implemented
'which' as a bash shell script and fixed problems with the csh
implementation making the Debian 'which' usable but different from
everyone else's 'which' command.
And newer GNU systems have GNU which; a stand-alone program that does
neat things like read aliases from stdin so that you can do:
$ which ll
alias ll='ls -l --color=tty'
/usr/local/bin/ls
$ alias which
alias which='alias | which -i'
$ which --version
GNU which v2.16, Copyright (C) 1999 - 2003 Carlo Wood.
[snip]
--
Matthew
Caution: keep out of reach of adults.
_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash