Annotation of researchv10no/cmd/which.sh, revision 1.1.1.1

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

unix.superglobalmegacorp.com

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