achenle,
your approach looks very promising, but I have following questions:
1. What does "set -bm" stand for?
2. How does the flow look like? There are two variants I can think of:
Let's assume every job will run for 5 minutes and let's forget about that SIGCHLD thing.
2.a It starts with line 20, the function startjob is called, "started=$(($started+1))" does *NOT* take effect, 1st job gets started, $count=1, line 20 calls the startjob function again ................................. $count=100 !! All 100 jobs are running at the same time.
2.b It starts with line 20, the function startjob is called, $started=1, 1st job gets started, $count=1, .... Script ends after 10 jobs, because $started=10.
3. IMHO that "wait" line is pretty unnecessary (pls. correct me if I'm wrong)
Is there an error in the way I think how it will work