Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.25 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. startNewProcess() {
  4.    echo Starting process $1
  5.    sleep 10 &
  6. }
  7.  
  8. for file in 1 2 3 4 5 6 7 8 9 10
  9. do
  10.    while true
  11.    do
  12.      [ `jobs | wc -l` -lt 4 ] && break
  13.      jobs
  14.      sleep 1
  15.    done
  16.    startNewProcess $file
  17. done
  18. wait
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement