1*11060Smckusick#! /bin/csh -f 211059Smckusick# 3*11060Smckusick# @(#)which.csh 4.2 (Berkeley) 83/02/14 411059Smckusick# 511059Smckusick# which : tells you which program you get 6*11060Smckusick# 711059Smckusickset noglob 811059Smckusickforeach arg ( $argv ) 911059Smckusick set alius = `alias $arg` 1011059Smckusick switch ( $#alius ) 1111059Smckusick case 0 : 1211059Smckusick breaksw 1311059Smckusick case 1 : 1411059Smckusick set arg = $alius[1] 1511059Smckusick breaksw 1611059Smckusick default : 1711059Smckusick echo ${arg}: " " aliased to $alius 1811059Smckusick continue 1911059Smckusick endsw 2011059Smckusick unset found 2111059Smckusick if ( $arg:h != $arg:t ) then 2211059Smckusick if ( -e $arg ) then 2311059Smckusick echo $arg 2411059Smckusick else 2511059Smckusick echo $arg not found 2611059Smckusick endif 2711059Smckusick continue 2811059Smckusick else 2911059Smckusick foreach i ( $path ) 3011059Smckusick if ( -x $i/$arg && ! -d $i/$arg ) then 3111059Smckusick echo $i/$arg 3211059Smckusick set found 3311059Smckusick break 3411059Smckusick endif 3511059Smckusick end 3611059Smckusick endif 3711059Smckusick if ( ! $?found ) then 3811059Smckusick echo no $arg in $path 3911059Smckusick endif 4011059Smckusickend 41