From: Bill Reynolds (bill@yossarian.ucsd.edu)
Date: 08/05/93


From: bill@yossarian.ucsd.edu (Bill Reynolds)
Subject: Re: which: the /usr/ucb/which
Date: 5 Aug 1993 02:34:19

In article <1993Aug5.062534.5952@sol.UVic.CA> pmacdona@sanjuan (Peter MacDonald) writes:
   In article <93217.043939K111114@ALIJKU11.BITNET> <K111114@ALIJKU11.BITNET> writes:
>greetigs,
>
>a small, nice, cheap and valuable tool: "which"
>will save u a lot of confusion, for searching "which" binary
>you are using (/bin/gcc ? /usr/bin/gcc ? /home/franz/gcc ?? WHICH!!!)
>
>probably, the next SLS distribution could have it in /usr/bin/which ?
>
>for those, who don't want to look at various ftp-servers, i have the
>precompiled binary at the wildsow: wildsau.idv.uni-linz.ac.at (140.78.40.25)
>in directory /pub/linux/ports, which and which.1
>
>greetings, herp

   Aready does. It is an alias under bash for "type -t".

   Peter

I think it's aliased to "type -path" which (;-) unfortunately won't
tell you about commands that you have aliased or written shell
function wrappers for, i.e.

        yossarian{bill}{bill}269: alias ls
        alias ls='ls -sCF'
        yossarian{bill}{bill}270: type -path ls
        yossarian{bill}{bill}271:

The following works much better:

        which ()
        {
            type -all -path $* | head -1
        }

which yields,

        yossarian{bill}{bill}273: which ls
        /bin/ls