[talk] kill -0

Raul Cuza raulcuza at gmail.com
Fri May 10 14:00:54 EDT 2019


Hola People Who Use Shells,

I just had someone submit a shell script using `kill -0 ${PID}` to
test if a process is running. It exits non-zero if ${PID} isn't a
running process and zero otherwise. But...

http://nixdoc.net/man-pages/FreeBSD/kill.1.html says nothing about it.

The ubuntu man page mentions it poorly with "Particularly useful
signals include HUP, INT, KILL, STOP, CONT, and 0." Looking at `kill
--list` there is no signal 0.

And stackoverflow says
https://stackoverflow.com/questions/11012527/what-does-kill-0-pid-in-a-shell-script-do
matching what the person who submitted the PR says.

Am I wrong to think this should be accomplished in a way with better
documentation? I feel like I am nit picking.

Raúl




More information about the talk mailing list