Annotation of 42BSD/ucb/which.csh, revision 1.1.1.1

1.1       root        1: #! /bin/csh -f
                      2: #
                      3: #      @(#)which.csh   4.2     (Berkeley)      83/02/14
                      4: #
                      5: #      which : tells you which program you get
                      6: #
                      7: set noglob
                      8: foreach 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
                     40: end

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.