07/04/23 20:32:55
kill -0 $pid 2>/dev/null || break
の方がベターだな。
>>586
man 2 kill
The kill() system call sends the signal given by sig to pid, a process or
a group of processes. The sig argument may be one of the signals speci-
fied in sigaction(2) or it may be 0, in which case error checking is per-
formed but no signal is actually sent. This can be used to check the
validity of pid.
プロセスが存在してそのプロセスにシグナルを送る権限があれば正常終了。
それ以外はエラー。つまり、プロセスの生存確認に使用できる。