From owner-freebsd-current Fri Mar 3 8:13:21 2000 Delivered-To: freebsd-current@freebsd.org Received: from mail.rpi.edu (mail.rpi.edu [128.113.100.7]) by hub.freebsd.org (Postfix) with ESMTP id 70F4F37B6A4 for ; Fri, 3 Mar 2000 08:13:18 -0800 (PST) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.acs.rpi.edu [128.113.24.47]) by mail.rpi.edu (8.9.3/8.9.3) with ESMTP id LAA526248; Fri, 3 Mar 2000 11:12:55 -0500 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: <38BF334F.2F10D4B0@confusion.net> References: <38BF334F.2F10D4B0@confusion.net> Date: Fri, 3 Mar 2000 11:13:23 -0500 To: Laurence Berland , Chuck Robey From: Garance A Drosihn Subject: Re: which(1), rewritten in C? Cc: Alfred Perlstein , Dan Papasian , current@FreeBSD.ORG Content-Type: text/plain; charset="us-ascii" ; format="flowed" Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 = gad@eclipse.acs.rpi.edu Senior Systems Programmer or drosih@rpi.edu Rensselaer Polytechnic Institute To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message