<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, May 10, 2019 at 3:06 PM Pete Wright <<a href="mailto:pete@nomadlogic.org">pete@nomadlogic.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
On 2019-05-10 11:59, Pete Wright wrote:<br>
><br>
><br>
> On 2019-05-10 11:00, Raul Cuza wrote:<br>
>> Hola People Who Use Shells,<br>
>><br>
>> I just had someone submit a shell script using `kill -0 ${PID}` to<br>
>> test if a process is running. It exits non-zero if ${PID} isn't a<br>
>> running process and zero otherwise. But...<br>
>><br>
>> <a href="http://nixdoc.net/man-pages/FreeBSD/kill.1.html" rel="noreferrer" target="_blank">http://nixdoc.net/man-pages/FreeBSD/kill.1.html</a> says nothing about it.<br>
>><br>
>> The ubuntu man page mentions it poorly with "Particularly useful<br>
>> signals include HUP, INT, KILL, STOP, CONT, and 0." Looking at `kill<br>
>> --list` there is no signal 0.<br>
>><br>
>> And stackoverflow says<br>
>> <a href="https://stackoverflow.com/questions/11012527/what-does-kill-0-pid-in-a-shell-script-do" rel="noreferrer" target="_blank">https://stackoverflow.com/questions/11012527/what-does-kill-0-pid-in-a-shell-script-do</a> <br>
>><br>
>> matching what the person who submitted the PR says.<br>
>><br>
>> Am I wrong to think this should be accomplished in a way with better<br>
>> documentation? I feel like I am nit picking.<br>
><br>
> this seems like a bash'ism - from the bash manpage:<br>
><br>
> SIGNALS<br>
> When bash is interactive, in the absence of any traps, it ignores<br>
> SIGTERM (so that kill 0 does not kill an interactive shell), <br>
> and SIGINT<br>
> is caught and handled (so that the wait builtin is <br>
> interruptible). In<br>
> all cases, bash ignores SIGQUIT. If job control is in effect, <br>
> bash<br>
> ignores SIGTTIN, SIGTTOU, and SIGTSTP.<br>
><br>
><br>
<br>
heh wish i saw Jan's post before i wrote this as his reply seems to <br>
answer the real question...<br>
<br>
-p<br>
<br>
-- <br>
Pete Wright<br>
<a href="mailto:pete@nomadlogic.org" target="_blank">pete@nomadlogic.org</a><br>
@nomadlogicLA<br>
<br>
_______________________________________________<br>
talk mailing list<br>
<a href="mailto:talk@lists.nycbug.org" target="_blank">talk@lists.nycbug.org</a><br>
<a href="http://lists.nycbug.org:8080/mailman/listinfo/talk" rel="noreferrer" target="_blank">http://lists.nycbug.org:8080/mailman/listinfo/talk</a><br></blockquote><div><br></div><div><br></div><div>It feels safer to me to use ps route. Even if you are counting the os to preserve the 0 behaviour I feel I would fat finger it and send a kill -1 or 2 <br></div></div></div>