1#! /bin/csh 2# 3# @(#)which.csh 4.3 (Berkeley) 84/01/23 4# 5# which : tells you which program you get 6# 7set noglob 8foreach arg ( $argv ) 9 set alius = `alias $arg` 10 switch ( $#alius ) 11 case 0 : 12 breaksw 13 case 1 : 14 set arg = $alius[1] 15 breaksw 16 default : 17 echo ${arg}: " " aliased to $alius 18 continue 19 endsw 20 unset found 21 if ( $arg:h != $arg:t ) then 22 if ( -e $arg ) then 23 echo $arg 24 else 25 echo $arg not found 26 endif 27 continue 28 else 29 foreach i ( $path ) 30 if ( -x $i/$arg && ! -d $i/$arg ) then 31 echo $i/$arg 32 set found 33 break 34 endif 35 end 36 endif 37 if ( ! $?found ) then 38 echo no $arg in $path 39 endif 40end 41