Annotation of 3BSD/cmd/which.sh, revision 1.1.1.1

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

unix.superglobalmegacorp.com

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