home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / unix / shell / 5148 < prev    next >
Encoding:
Internet Message Format  |  1992-12-23  |  951 b 

  1. Path: sparky!uunet!spool.mu.edu!yale.edu!jvnc.net!rutgers!att-out!pacbell.com!lll-winken!phoenix!busby
  2. From: busby@phoenix.ocf.llnl.gov (lee e busby)
  3. Newsgroups: comp.unix.shell
  4. Subject: Last background PID in CSH?
  5. Summary: Anybody know a good way to get the PID of the last background process?
  6. Message-ID: <144303@lll-winken.LLNL.GOV>
  7. Date: 23 Dec 92 22:12:17 GMT
  8. Sender: usenet@lll-winken.LLNL.GOV
  9. Organization: Lawrence Livermore National Laboratory
  10. Lines: 9
  11. Nntp-Posting-Host: phoenix.ocf.llnl.gov
  12.  
  13. Seems like it should be easy, but I can't figure out a good way to
  14. do it.  Inside of a CSH script, I start up a command and put it in
  15. the background.  Later on, I want to come back and kill the
  16. backgrounded process.  How to refer to it?  (It's easy with the
  17. Bourne shell, of course.)
  18.  
  19. Right now, the best I have come up with is to start the process,
  20. then run "jobs -l" and parse the output with awk to get the PID.
  21. Surely there's a smarter way....
  22.