Mailinglist Archive: opensuse (527 mails)

< Previous Next >
Re: [opensuse] which which?
Hello,

On Tue, 30 Aug 2016, Neil Rickert wrote:
On 08/29/2016 08:30 PM, Michael Fischer wrote:

Once upon a time, SuSE had a which(1) which was actually type(1) with " -a".

Nope.

==== openSUSE-10.2 : aaa_base-10.2-38.i586.rpm : /etc/bash.bashrc ====
if test "$is" = "bash" ; then
#
# Other shells use the which command in path (e.g. ash) or
# their own builtin for the which command (e.g. ksh and zsh).
#
_which () {
local file=$(type -p ${1+"$@"} 2>/dev/null)
if test -n "$file" -a -x "$file"; then
echo "$file"
return 0
fi
hash -r
type -P ${1+"$@"}
}
alias which=_which
fi
====

So, it actually is an alias to the above function _which using
'type -p "$@" || { hash -r; type -P "$@"; }

And openSUSE-10.2 has a /usr/bin/which in util-linux.

And SUSE-7.0 has '/usr/bin/which' in base.rpm and has

alias which='type -p'

in /etc/profile (from aaa_base).

I guess enough people have found "which" to be a useful command, that it
has now been made a binary. But, for "csh" users, it is still a built-in.

See above. Your "now" is quite long ago, IIRC 5.3 and 6.2 were the
same. And just for comparison, Debian-1.3 ("Bo") (from 5 June 1997!)
also had /usr/bin/which in the package base/debianutils and apparently
no "ready-made" alias which.

-dnh

--
A tangled cable is a happy cable. -- R. B. West
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups