fast which v3.0. A shorter method
Ian Phillipps
igp at torch.co.uk
Fri Jan 12 20:25:33 AEST 1990
IMHO, this is just as quick, and a bit shorter.
Note the (brackets) in the alias: this executes in a fork of your login shell
and prevents the parameters creeping into your environment.
You'll want to put in a complete path name instead of which.src.
BUGS: you can't do `which foo`
cat <<'END_OF_SHAR' >which.src
# execute as a "sourced" file
# Parameter WhichWhich is set to name list to be scanned
# Set up with:
# alias which '(set WhichWhich=(\!*); source which.src )'
foreach x ( $WhichWhich )
set TempWhich=`alias $x`;
if ( $#TempWhich > 0 ) echo alias: $x "'$TempWhich'"
# if ( $#TempWhich > 0 ) break # Break here if only
foreach f ($path)
if ( -f $f/$x ) then
echo $f/$x
# break # Break here if only one filename wanted
endif
end
end
END_OF_SHAR
exit
More information about the Alt.sources
mailing list