The regex for grep is flawed. '^$PID" assumes the PID will occur at exactly
the beginning of the line, when in fact it is [generally?] preceded by some
whitespace. I initially fixed this by replacing the grep test string with
'^[ ]*$PID', but then considered that it may be more elegantly solved by
testing kill -0 $PID, which avoids a pipe and two more expensive commands.

That said, I don't know if Carlos's solution is even closer to the "right
way" to accomplish this, but this one gets it done as well.

-David R. Hedges

Attachment: thttpd.init
Description: Binary data

Reply via email to