At 10:36 PM -0500 3/2/00, Laurence Berland wrote:
>Which is also a perl script, which sh uses (since it's not a builtin
>there).  It does the same thing as the 'which' that's built in to bash
>and tcsh and csh

If you do a 'type -a which' or 'help which' in bash, you'll find that
'which' is not a built-in function in bash either.  Sh/bash people
would be more likely to use 'type blah' or 'type -a blah' instead
of 'which blah'.

(at least, it isn't a built-in function on my machine...)

Having used csh for awhile before switching to bash, and also not
thrilled with /usr/bin/which, I have a function for it in my bashrc:

function which {
    local which_temp
    while [ "$1" ]; do
       which_temp=`type -type $1`
       if [ "$which_temp" = "file" ]; then
          type -path $1
       else
          if [ "$which_temp" ]; then
             type -all $1
          else
             echo no $1 in $PATH
          fi
       fi
       shift
    done
}

That's just included for amusement purposes (and I'm not sure it
behaves exactly the way 'which' would in csh).  I do like the idea
of /usr/bin/which being rewritten into C...


---
Garance Alistair Drosehn           =   [EMAIL PROTECTED]
Senior Systems Programmer          or  [EMAIL PROTECTED]
Rensselaer Polytechnic Institute


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to