[opensuse] which which?

Once upon a time, SuSE had a which(1) which was actually type(1) with " -a". Recently noticed that which(1) is now actually /usr/bin/which. Just curious, but what was the reason for the back and forth? Best, Michael -- Michael Fischer michael@visv.net -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org

Michael Fischer wrote:
Once upon a time, SuSE had a which(1) which was actually type(1) with " -a".
Recently noticed that which(1) is now actually /usr/bin/which.
Going back to 10.3, that was the case then. -- Per Jessen, Zürich (17.9°C) http://www.dns24.ch/ - free dynamic DNS, made in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org

On 08/30/2016 03:30 AM, Michael Fischer wrote:
Once upon a time, SuSE had a which(1) which was actually type(1) with " -a".
Recently noticed that which(1) is now actually /usr/bin/which.
Just curious, but what was the reason for the back and forth?
I'd guess that it's because which(1) is usable without a shell: $ type type type is a shell builtin $ env type env: ‘type’: No such file or directory Have a nice day, Berny -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org

On Tue, Aug 30, Bernhard Voelker wrote:
On 08/30/2016 03:30 AM, Michael Fischer wrote:
Once upon a time, SuSE had a which(1) which was actually type(1) with " -a".
Recently noticed that which(1) is now actually /usr/bin/which.
Just curious, but what was the reason for the back and forth?
I'd guess that it's because which(1) is usable without a shell:
$ type type type is a shell builtin
$ env type env: ‘type’: No such file or directory
Good lord. Under what circumstances would I "not have a shell"? Would that be where a program (e.g. perl/python/ruby) tries to execute `which`? But I would think that is actually effectively `sh -c "which $something"` from the calling program. Yeah, it was a while back, pre-openSuSE, that I discovered that which(1) was an alias for `type -a`, but.. at least it taught me how useful `type -a` is :-) Thanks. Michael -- Michael Fischer michael@visv.net -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org

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".
Recently noticed that which(1) is now actually /usr/bin/which.
Just curious, but what was the reason for the back and forth?
Best,
Michael
I get: --- cut here --- % which which which: shell built-in command. --- cut here --- I should mention that I am using "csh" (or, really, "tcsh"). The "which" command was always a "csh" built-in. Remembering back, if I used the Bourne shell, and tried "which" it still worked. Checking, I found that there was a "csh" shell script on the standard path which simply invoked the "csh" built-in. 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. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org

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@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org

On Tue, Aug 30, David Haller wrote:
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).
Hah! Thanks for the deep research on it. Yes, I think my (mis)memory is of the "alias which='type -p'" variety, going back about that far. I think I started with SuSE 6.2, back around... 2002-ish? Days when the printed manual in the boxed set had the occasional still-in-German sentence or paragraph :-) Cheers, Michael -- Michael Fischer michael@visv.net -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (5)
-
Bernhard Voelker
-
David Haller
-
Michael Fischer
-
Neil Rickert
-
Per Jessen