Subject: Re: /usr/bin/which is a csh script!!?!
To: George Michaelson <ggm@apnic.net>
From: Greg A. Woods <woods@weird.com>
List: current-users
Date: 04/29/2003 21:20:24
[ On Wednesday, April 30, 2003 at 10:33:46 (+1000), George Michaelson wrote: ]
> Subject: /usr/bin/which is a csh script!!?!
>
Not on my machine (I don't have any /bin/csh either :-):
#! /bin/sh
if [ "$1" = "-a" ] ; then
#
# this could search the PATH explicitly by individually setting
# PATH to each of its components and then trying "type"....
#
echo "$(basename $0): -a not supported in this version" 1>&2
exit 2
fi
# XXX this isn't a very true emulation since it explicitly ignores
# aliases and functions...
#
for prog
do
# NOTE: If this were a ksh script then it could just call "command -v"
location=$(expr "$(type ${prog})" : '[^/]*\(.*\)$')
if [ -n "${location}" ] ; then
echo "${location}"
fi
done
exit 0
--
Greg A. Woods
+1 416 218-0098; <g.a.woods@ieee.org>; <woods@robohack.ca>
Planix, Inc. <woods@planix.com>; VE3TCP; Secrets of the Weird <woods@weird.com>