Gentlemen, I am disturbed by these seemingly irregular results, # perl -pwle 's/\d{4}/0000/' mm|sort|uniq -c 88 ++ kill 0000 44 ++ set +m 44 ++ set -m 1 ++ sleep 33 2 ++ sleep 66 1 ./rt: line 12: 0000 Terminated sleep 33 1 ./rt: line 12: 0000 Terminated sleep 44 1 ./rt: line 13: 0000 Terminated sleep 33 1 ./rt: line 13: 0000 Terminated sleep 44 1 ./rt: line 13: 0000 Terminated sleep 55 3 ./rt: line 14: 0000 Terminated sleep 33 3 ./rt: line 14: 0000 Terminated sleep 44 3 ./rt: line 14: 0000 Terminated sleep 55 from running my program # cat rt set -x set -m sleep 33& kill $! set +m sleep 44& kill $! sleep 55& set -m kill $! sleep 66& set +m kill $! # for i in `seq 22`; do ./rt; done 2> mm
We see some of the sleeps are reported some of the time, and on what line something was terminated differs too. Also didn't I run it 22 times? Why do some things show up only a couple times instead of all or none? P.S., on the man page -m Monitor mode. Job control is enabled. This option is on by default for interactive shells on systems that support it (see JOB CONTROL above). Background processes run in a separate process group and a line containing their exit status is printed upon their completion. Perhaps mention if what happens if this is turned on or off after starting the job but before its completion.