home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / unix / programm / 5751 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  1.2 KB

  1. Path: sparky!uunet!spool.mu.edu!yale.edu!qt.cs.utexas.edu!cs.utexas.edu!torn!nott!bnrgate!bcars664!leibniz!walt
  2. From: walt@bcarh1d7.bnr.ca (Walt Sullivan)
  3. Newsgroups: comp.unix.programmer
  4. Subject: Re: ***  Simple batch-style Unix question
  5. Message-ID: <WALT.92Dec21111550@bcarh1d7.bnr.ca>
  6. Date: 21 Dec 92 16:15:50 GMT
  7. References: <1992Dec11.222613.10867@murdoch.acc.Virginia.EDU>
  8. Sender: news@bcars664.bnr.ca
  9. Followup-To: sender
  10. Organization: Bell-Northern Research, Ottawa, Canada
  11. Lines: 23
  12. In-reply-to: tdh6t@fulton.seas.Virginia.EDU's message of 11 Dec 92 22:26:13 GMT
  13.  
  14. >>>>> On 11 Dec 92 22:26:13 GMT, tdh6t@fulton.seas.Virginia.EDU (Todd #$%!@! Hodes) said:
  15.  
  16. Todd>         Firstly, I'm under SunOS 4.1.1.
  17.  
  18. Todd>         Now... say I've gotten a process ID from grep'ing a
  19. Todd> ps command, and want to send it to a 'kill -9'
  20.  
  21. Todd>         How do I do this ?
  22.  
  23. Todd> ps -aux | grep "xv " | sort -2 | awk '{if (NR == 1) print $2;}' | cat
  24.  
  25. Todd> outputs the correct pid.
  26.  
  27. You want to pass the output of the above as an argument to kill. Use backticks (`):
  28.  
  29. kill -9 `ps -aux | grep "xv " | sort -2 | awk '{if (NR == 1) print $2;}'`
  30.  
  31.  
  32. --
  33. Walt Sullivan
  34. INTERNET: walt@bnr.ca (work)
  35. UUCP: walt@orbit.ocunix.on.ca (home)
  36. FIDO: 1:163/109.4
  37.