awk script
Tom Christiansen
tchrist at convex.COM
Tue Mar 19 04:21:06 AEST 1991
>From the keyboard of drears at pica.army.mil:
: I need to write a shell script that will allow users to kill all thier
:processes associated that a program name. This script will run on a HP
:9000/835, which is a SYSV Unix.
:
: I am having problems with the awk script in the following script
:fragment:
:
:CMD='artemis'
:ME=`whoami`
:PROC=`ps -ef|grep /${CMD}| \
:awk '{ $1 == ${ME} && $8 != "grep" $2 }' `
:kill -HUP ${PROC}
Two problems:
you don't want that slash in the grep command,
you can't depend on field counts on ps (on mine at least)
There is a nice zap script in the perl book, or available on uunet.
--tom
More information about the Comp.unix.questions
mailing list