On Wed, Apr 09, 2014 at 02:16:22PM +0200, Håkon Bugge wrote:
> That is not the issue. Try it out.
Very well. I can confirm that this script does not terminate on HP-UX
10.20 under bash 4.3.8:
#!/bin/bash
set -m
for x in 1 2 3 4 5; do sleep 1 & done
while jobs=$(jobs -p)
echo "jobs left: <$jobs>"
[[ $jobs != "" ]]
do
sleep 1
done
As a workaround, you could consider using "wait" instead of this polling
loop to detect the termination of child processes. This script, for
example, properly waits and terminates:
#!/bin/bash
set -m
for x in 1 2 3 4 5; do sleep 1 & done
wait