Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!emory!gatech!mcnc!taco!ncsuvx.enet.dec.com!snpatel From: snpatel@ncsuvx.enet.dec.com (SHETAL NATAWARBH PATEL) Newsgroups: comp.unix.questions Subject: Re: awk script Keywords: awk, ps, kill Message-ID: <1991Mar19.233802.12679@ncsu.edu> Date: 19 Mar 91 23:38:02 GMT References: <1991Mar18.193118.17247@athena.mit.edu> <1991Mar19.171332.28055@colorado.edu> <1991Mar20.004422.6228@athena.mit.edu> Sender: news@ncsu.edu (USENET News System) Reply-To: snpatel@ncsuvx.enet.dec.com (SHETAL NATAWARBH PATEL) Organization: Digital Equipment Corporation Lines: 27 > > CMD='dxclock' > ME=`whoami` > PROC=`ps -ef | grep /${CMD}| > awk '$1 == '${ME}' && $8 != "grep" {print $2}'` > kill -HUP ${PROC} > I tried this script and it doesn't work. But I finally got this to work, CMD='dxclock' ME=`whoami` PROC=`ps -aux | grep ${CMD}|grep -v grep| \ awk '{print $2}'` kill -9 ${PROC} Is there any way to ask the user to type in the command that they wish to kill and then kill it after the entry? -- Nothing more smooth than glass, yet nothing more brittle; Nothing more fine than wit, yet nothing more fickle. -=> Thomas Fuller, Gnomologia No. 6472 <=- +-----------------------------------------------------------------+ | Shetal N. Patel | | snpatel@eos.ncsu.edu NORTH CAROLINA STATE UNIVERSITY | +-----------------------------------------------------------------+