home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!sdd.hp.com!think.com!yale.edu!ira.uka.de!math.fu-berlin.de!mailgzrz.TU-Berlin.DE!mailgzrz.tu-berlin.de!nickel
- From: nickel@cs.tu-berlin.de (Juergen Nickelsen)
- Newsgroups: comp.unix.programmer
- Subject: Re: *** Simple batch-style Unix question
- Date: 12 Dec 1992 21:41:31 GMT
- Organization: STONE Project, Technical University of Berlin, Germany
- Lines: 27
- Message-ID: <NICKEL.92Dec12224130@desaster.cs.tu-berlin.de>
- References: <1992Dec11.222613.10867@murdoch.acc.Virginia.EDU>
- Reply-To: nickel@cs.tu-berlin.de
- NNTP-Posting-Host: desaster.cs.tu-berlin.de
- In-reply-to: tdh6t@fulton.seas.Virginia.EDU's message of Fri, 11 Dec 1992 22:26:13 GMT
- To:
-
- In article <1992Dec11.222613.10867@murdoch.acc.Virginia.EDU>
- tdh6t@fulton.seas.Virginia.EDU (Todd #$%!@! Hodes) writes:
-
- > Now... say I've gotten a process ID from grep'ing a
- > ps command, and want to send it to a 'kill -9'
- >
- > How do I do this ?
- >
- > ps -aux | grep "xv " | sort -2 | awk '{if (NR == 1) print $2;}' | kill -9
- >
- > fails on the last pipe (the kill)
- [...]
-
- kill(1) does not read its standard input. To issue a kill command, you
- have to give the pid to kill as an *argument*.
-
- So, instead of "command_that_prints_the_pid | kill" you have to use
- the backquote mechanism as in "kill `command_that_prints_the_pid`".
-
- BTW, you should use the KILL signal (9) only when absolutely
- necessary. Several programs need to do some necessary cleanup before
- they terminate; this is impossible when they receive the KILL signal,
- since it can't be caught. Use the "softer" signals HUP, TERM, INTR,
- QUIT (1, 15, 2, 3) instead whereever possible.
-
- --
- Juergen Nickelsen
-