|
|
1.1 ! root 1: #!/bin/csh ! 2: # ! 3: # DO NOT USE "csh -f" ! 4: # ! 5: # Copyright (c) 1980 Regents of the University of California. ! 6: # All rights reserved. ! 7: # ! 8: # Redistribution and use in source and binary forms are permitted ! 9: # provided that this notice is preserved and that due credit is given ! 10: # to the University of California at Berkeley. The name of the University ! 11: # may not be used to endorse or promote products derived from this ! 12: # software without specific prior written permission. This software ! 13: # is provided ``as is'' without express or implied warranty. ! 14: # ! 15: # @(#)which.csh 5.4 (Berkeley) 4/19/88 ! 16: # ! 17: # which : tells you which program you get ! 18: # ! 19: set prompt = "% " ! 20: set noglob ! 21: foreach arg ( $argv ) ! 22: set alius = `alias $arg` ! 23: switch ( $#alius ) ! 24: case 0 : ! 25: breaksw ! 26: case 1 : ! 27: set arg = $alius[1] ! 28: breaksw ! 29: default : ! 30: echo ${arg}: " " aliased to $alius ! 31: continue ! 32: endsw ! 33: unset found ! 34: if ( $arg:h != $arg:t ) then ! 35: if ( -e $arg ) then ! 36: echo $arg ! 37: else ! 38: echo $arg not found ! 39: endif ! 40: continue ! 41: else ! 42: foreach i ( $path ) ! 43: if ( -x $i/$arg && ! -d $i/$arg ) then ! 44: echo $i/$arg ! 45: set found ! 46: break ! 47: endif ! 48: end ! 49: endif ! 50: if ( ! $?found ) then ! 51: echo no $arg in $path ! 52: endif ! 53: end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.