Hi, I just stumbled upon this older thread again and had an epiphany:

Seb dixit:

>What is weird is that it does not work even with $!, which is a PID.
>This never ends:
>
>  set -m
>  cat /dev/zero >/dev/null &
>  kill -s "TERM" $!
>  wait

Oh, look at this:

tg@blau:~ $ mksh -x x
+ set -m
+ kill -s TERM 16263
+ wait
+ /bin/cat /dev/zero
+ >/dev/null
^C

And, voilà:

tg@blau:~ $ mksh -x x; echo $?
+ set -m
+ sleep 1
+ /bin/cat /dev/zero
+ >/dev/null
+ kill -s TERM 24528
+ wait
[1] + Terminated           /bin/cat /dev/zero >/dev/null
0

The trick here is to realise that the background process may not
yet have started up before it’s killed.

HTH & HANE,
//mirabilos
-- 
13:37⎜«Natureshadow» Deep inside, I hate mirabilos. I mean, he's a good
guy. But he's always right! In every fsckin' situation, he's right. Even
with his deeply perverted taste in software and borked ambition towards
broken OSes - in the end, he's damn right about it :(! […] works in mksh

Reply via email to