Return to Snippet

Revision: 48291
at June 28, 2011 11:55 by alfirth


Initial Code
#!/bin/bash
for i in {1..10}; do  
  while [ `jobs | wc -l` -ge 4 ] ; do  
    sleep 1 
  done
  (echo $i ; sleep 3 ) & 
done

Initial URL

                                

Initial Description
this works even if you call this script in the background... awesome

Initial Title
Background a certain number of jobs in bash using job control

Initial Tags

                                

Initial Language
Bash