Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. ```
  2. #!/bin/bash
  3.  
  4. pids=()
  5.  
  6. thread() {
  7. local this
  8. while [ ${#} -gt 6 ]; do
  9. this=${1}
  10. wait "$this"
  11. shift
  12. done
  13. pids=($1 $2 $3 $4 $5 $6)
  14. }
  15.  
  16. for i in 1 2 3 4 5 6 7 8 9 10
  17. do
  18. <<< COMMAND >>> &
  19. pids=( ${pids[@]-} $(echo $!) )
  20. thread ${pids[@]}
  21. done
  22.  
  23. for pid in ${pids[@]}
  24. do
  25. wait "$pid"
  26. done
  27. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement