|
|
1.1 root 1: #!/bin/csh -f
2: #
3: # Copyright (c) 1980 Regents of the University of California.
4: # All rights reserved. The Berkeley software License Agreement
5: # specifies the terms and conditions for redistribution.
6: #
7: # @(#)which.csh 5.2 (Berkeley) 7/29/85
8: #
9: # which : tells you which program you get
10: #
11: set prompt = "% "
12: if ( -f ~/.cshrc) then
13: source ~/.cshrc
14: endif
15: set noglob
16: foreach arg ( $argv )
17: set alius = `alias $arg`
18: switch ( $#alius )
19: case 0 :
20: breaksw
21: case 1 :
22: set arg = $alius[1]
23: breaksw
24: default :
25: echo ${arg}: " " aliased to $alius
26: continue
27: endsw
28: unset found
29: if ( $arg:h != $arg:t ) then
30: if ( -e $arg ) then
31: echo $arg
32: else
33: echo $arg not found
34: endif
35: continue
36: else
37: foreach i ( $path )
38: if ( -x $i/$arg && ! -d $i/$arg ) then
39: echo $i/$arg
40: set found
41: break
42: endif
43: end
44: endif
45: if ( ! $?found ) then
46: echo no $arg in $path
47: endif
48: end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.