home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / shell / 3704 < prev    next >
Encoding:
Internet Message Format  |  1992-08-30  |  1.2 KB

  1. Xref: sparky comp.unix.shell:3704 comp.unix.questions:10551
  2. Path: sparky!uunet!crdgw1!rdsunx.crd.ge.com!rdsunx!montnaro
  3. From: montnaro@ausable.crd.ge.com (Skip Montanaro)
  4. Newsgroups: comp.unix.shell,comp.unix.questions,netcom.general
  5. Subject: Re: Need Script To Kill Process Using Substring Of Application Name
  6. Message-ID: <MONTNARO.92Aug30221640@ausable.crd.ge.com>
  7. Date: 31 Aug 92 03:16:40 GMT
  8. References: <x6gnwvc.westes@netcom.com>
  9. Sender: usenet@crd.ge.com (Required for NNTP)
  10. Reply-To: montanaro@crd.ge.com (Skip Montanaro)
  11. Organization: GE Corporate Research & Development, Schenectady, NY
  12. Lines: 18
  13. In-Reply-To: westes@netcom.com's message of 30 Aug 92 23:07:51 GMT
  14. Nntp-Posting-Host: ausable.crd.ge.com
  15.  
  16. In article <x6gnwvc.westes@netcom.com> westes@netcom.com (Will Estes) writes:
  17.  
  18.    Does anyone have a script that they could send to me that will take as
  19.    its input some substring and then kill any process you own that has that
  20.    substring in its application name?
  21.  
  22. Here's a script that might fit the bill:
  23.  
  24.     #!/bin/sh
  25.  
  26.     ps -auxww | egrep $1 | grep -v egrep | awk '{print $2}' | xargs kill
  27.  
  28. Call it slay?
  29.  
  30. Of course, on a SysV machine it will have to be "ps -efl" and "{print $3}".
  31.  
  32. --
  33. Skip (montanaro@crd.ge.com)
  34.