#!/bin/csh -fb # Kill by name # # if ($#argv == 0) then echo "Usage: $0:t processName(s)" exit 0 endif foreach inp ($argv) foreach procNum (`/bin/ps xw | /bin/grep "$inp" | egrep -v grep\|$0 | /bin/awk '{print $1}'`) #echo "$procNum $$" #exclude my self: if ($procNum != $$ ) then set procName = "`/bin/ps $procNum | /bin/sed -e '/PID/d' -e 's/.*:...//'`" if ("$procName" != "") then echo -n "Kill? [y/n] : [$procName] " if ("$<" == "y") then kill -9 $procNum endif endif endif end end