kill -0 pid 不發送任何信號,但是系統會進行錯誤檢查。
所以經常用來檢查一個進程是否存在,存在則echo $?返回0;不存在返回1
man手冊裏:
The signals listed below may be available for use with kill. When known constant, numbers and default behavior are shown. Name Num Action Description 0 0 n/a exit code indicates if a signal may be sent
原文地址:http://blog.csdn.net/pecywang/article/details/8558968