On Wed, 2021-08-18 at 22:58 +0500, Andrey Rahmatullin wrote: > On Wed, Aug 18, 2021 at 12:36:43PM -0500, Gunnar Wolf wrote: > > I agree with you, maintainer scripts should not rely on 'which' > > anymore. However, what about users? 'which' is a standard Unix tool > > since forever, and I expect many users to experience head scratching > > when told it's not cool to use it anymore. > Why is a standard Unix tool since forever shipped by a package called > debianutils, that has a description saying "Miscellaneous utilities > specific to Debian" and "used primarily by the installation scripts of > Debian packages"? Surely a standard Unix tool would, or at least could, be > shipped somewhere else?
3BSD first implemented 'which': <https://minnie.tuhs.org/cgi-bin/utree.pl?file=3BSD/usr/man/man1/which.1> (1979). This was csh-specific and I think it later became built-into csh. FreeBSD 2.1 introduced a new non-built-in implementation: <https://www.freebsd.org/cgi/man.cgi?query=which&apropos=0&sektion=0&manpath=FreeBSD+2.1.0-RELEASE&arch=default&format=html> (1995). This was written in Perl and then rewritten in C a few years later. Debian's implementation started out in 1995 or 1996 as a shell script calling 'type', and remains a shell script. Red Hat has yet another implementation: <https://www.freebsd.org/cgi/man.cgi?query=which&apropos=0&sektion=0&manpath=CentOS+7.1&arch=default&format=html>, <https://carlowood.github.io/which/> (1999 or earlier). This is written in C. So 'which' has a very long history in csh, which was the default interactive shell in many versions of Unix. Its availability to other shells dates back to the 90s (at least) but is not portable due to there being multiple very different implementations. Ben. -- Ben Hutchings [W]e found...that it wasn't as easy to get programs right as we had thought. I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs. - Maurice Wilkes, 1949
signature.asc
Description: This is a digitally signed message part