kill EXPR, LIST |
發送信號的進程列表。返回成功信號的進程數。
如果SIGNAL是零,則冇有信號被發送到該進程。這是一個非常有用的方法來檢查,一個子進程是否還活著(存在),並冇有改變它的UID。
支持信號的精確列表是完全依賴於係統實現的。
Name Effect SIGABRT Aborts the process SIGARLM Alarm signal SIGFPE Arithmetic exception SIGHUP Hang up. SIGILL Illegal instruction SIGINT Interrupt SIGKILL Termination signal SIGPIPE Write to a pipe with no readers. SIGQUIT Quit signal. SIGSEGV Segmentation fault SIGTERM Termination signal SIGUSER1 Application-defined signal 1 SIGUSER2 Application-defined signal 2
返回成功信號的進程數
試試下麵的例子:
#!/usr/bin/perl
#by www.gitbook.net
$cnt = kill 0, getppid(), getpgrp(), 2000;
print "Signal sent to $cnt process\n";
It will produce foillowing result, because process 2000 does not exist
Signal sent to 2 process