awk script

Dennis G. Rears drears at pilot.njin.net
Tue Mar 19 02:52:09 AEST 1991


   
   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}
 
   I want awk to output the process numbers (Field 2) where the
username (field 1) is equal to the variable ${ME} and field 8 is not equal
to 'grep'.   Once I get that I can just do a "kill -HUP ${PROC}"
Can anyone tell me what I am doing wrong or suggest a different way of
doing it.  This is one of my first attempts at using awk.  Thanks in
advance.

Dennis



More information about the Comp.unix.questions mailing list