#!/bin/csh  -f
#  kesu config  psname
if ( $#argv != 2 ) then
	echo "Usage: kesu configFile processname"
	exit 1
endif
#    set ps command( ps -ef  or ps aux  depending on the system)
set ps=`myps`
if( "x$ps" == "x" ) then
    echo myps should be modified
    exit 1
endif

#  alias gawk /usr/local/bin/gawk

set procn=`$ps | grep $USER | grep $2 | gawk 'index($0, "grep")==0 {print $2}' `
#     choose oldest proces number
@  old = $$
foreach f($procn)
#    echo $old  $f
    if( $f < $old ) then
	@ old = $f
    endif
end

kill -9 $old








