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

  1. Xref: sparky comp.unix.shell:3709 comp.unix.questions:10561
  2. Path: sparky!uunet!olivea!decwrl!csus.edu!netcom.com!tunxis
  3. From: tunxis@netcom.com (Gary A. Gorgen)
  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: <rqhnklc.tunxis@netcom.com>
  7. Date: 31 Aug 92 14:14:26 GMT
  8. References: <x6gnwvc.westes@netcom.com>
  9. Organization: Tunxis Design Inc. (408-749-9463)
  10. Lines: 22
  11.  
  12. In article <x6gnwvc.westes@netcom.com> westes@netcom.com (Will Estes) writes:
  13. >Does anyone have a script that they could send to me that will take as
  14. >its input some substring and then kill any process you own that has that
  15. >substring in its application name?  So the script would do something
  16. >like:
  17. >
  18. >    ps guaxww | grep "some_substring"
  19. >
  20. >then it would exclude the line that contained the grep command, locate
  21. >the PID of the remaining processes, and kill each one.  Please post the
  22. >script for others to see if its short enough.
  23. >
  24. >Thanks,
  25. >Will Estes        Internet: westes@netcom.com
  26.  
  27. You may have to change the ps & cut args to suit your needs.
  28.  
  29. kill -9 `ps|grep $1|grep -v grep|cut -c1-6`
  30. -- 
  31. Gary A. Gorgen      | "From ideas to PRODUCTS"
  32. tunxis@netcom.com   | Tunxis Design Inc.
  33.                     | 422 S. Murphy, Sunnyvale Ca. (408) 749-9463
  34.