![为什么“kill -0”会在不存在的进程上返回成功?](https://linux22.com/image/225920/%E4%B8%BA%E4%BB%80%E4%B9%88%E2%80%9Ckill%20-0%E2%80%9D%E4%BC%9A%E5%9C%A8%E4%B8%8D%E5%AD%98%E5%9C%A8%E7%9A%84%E8%BF%9B%E7%A8%8B%E4%B8%8A%E8%BF%94%E5%9B%9E%E6%88%90%E5%8A%9F%EF%BC%9F.png)
我使用的是 Ubuntu 22.04.3 LTS(Jammy Jellyfish)。
$ ps -p 1635
PID TTY TIME CMD
$ kill -0 1635 ; echo $?
0
$ type kill
kill is a shell builtin
$ echo $BASH_VERSION
5.1.16(1)-release
$ mount|grep proc
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
我希望kill -0
能回来bash: kill: (1635) - No such process
。
更新1
ps -eLf | awk 'NR == 1 || /1635/'
PID PPID LWP C NLWP STIME TTY TIME CMD
1632 1091 1635 0 9 13:07 ? 00:00:00 /usr/libexec/evolution-calendar-factory