shell 脚本中的 `kill -0 $pid` 有什么作用? [英] What does `kill -0 $pid` in a shell script do?

查看:22
本文介绍了shell 脚本中的 `kill -0 $pid` 有什么作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,'0'代表什么信号,因为在这里我看到信号数字从 1 开始.

Basically, what signal does '0' represent, because here I see SIGNAL numbers starting from 1.

推荐答案

将信号 0 发送到给定的 PID 只是检查是否有任何具有给定 的进程PID 正在运行,您有权向其发送信号.

sending the signal 0 to a given PID just checks if any process with the given PID is running and you have the permission to send a signal to it.

有关详细信息,请参阅以下联机帮助页:

For more information see the following manpages:

$ man 1 kill
...
If sig is 0, then no signal is sent, but error checking is still performed.
...

kill(2)

$ man 2 kill
...
If sig is 0, then no signal is sent, but error checking is still performed; this 
can be used to check for the existence of a process ID or process group ID.
...

这篇关于shell 脚本中的 `kill -0 $pid` 有什么作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆