SHARE
TWEET

Untitled

a guest Mar 25th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. ```
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top