< Perl Programming < Keywords
The kill keyword
The kill command sends a signal to a LIST of processes. Returns the number of arguments that were successfully used to signal. This is not necessarily the same as the number of processes actually killed, as a process group can also be killed. SIGNAL is either a name of a signal, or a signal number.
If the signal name is negative, it is the same as a negative number and kills a group of processes.
If SIGNAL is either 0, the string SIGZERO, or ZERO, no signal is sent to the process, but the command checks whether it's possible to send a signal to it. This is useful to check that a child process is still alive with the same UID.
Syntax
kill SIGNAL, LIST
kill SIGNAL
Examples
$cnt = kill 'HUP', $child1, $child2;
kill 'KILL', @goners;
kill '-KILL', $processes; # same as next line
kill -9, $processes; # same as previous line
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.