1*34016Sbostic#!/bin/csh 211059Smckusick# 3*34016Sbostic# DO NOT USE "csh -f" 4*34016Sbostic# 522409Sdist# Copyright (c) 1980 Regents of the University of California. 622409Sdist# All rights reserved. The Berkeley software License Agreement 722409Sdist# specifies the terms and conditions for redistribution. 811059Smckusick# 9*34016Sbostic# @(#)which.csh 5.3 (Berkeley) 04/19/88 1022409Sdist# 1111059Smckusick# which : tells you which program you get 1211060Smckusick# 1318283Smckusickset prompt = "% " 1411059Smckusickset noglob 1511059Smckusickforeach arg ( $argv ) 1611059Smckusick set alius = `alias $arg` 1711059Smckusick switch ( $#alius ) 1811059Smckusick case 0 : 1911059Smckusick breaksw 2011059Smckusick case 1 : 2111059Smckusick set arg = $alius[1] 2211059Smckusick breaksw 2311059Smckusick default : 2411059Smckusick echo ${arg}: " " aliased to $alius 2511059Smckusick continue 2611059Smckusick endsw 2711059Smckusick unset found 2811059Smckusick if ( $arg:h != $arg:t ) then 2911059Smckusick if ( -e $arg ) then 3011059Smckusick echo $arg 3111059Smckusick else 3211059Smckusick echo $arg not found 3311059Smckusick endif 3411059Smckusick continue 3511059Smckusick else 3611059Smckusick foreach i ( $path ) 3711059Smckusick if ( -x $i/$arg && ! -d $i/$arg ) then 3811059Smckusick echo $i/$arg 3911059Smckusick set found 4011059Smckusick break 4111059Smckusick endif 4211059Smckusick end 4311059Smckusick endif 4411059Smckusick if ( ! $?found ) then 4511059Smckusick echo no $arg in $path 4611059Smckusick endif 4711059Smckusickend 48