Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ```
- #!/bin/bash
- pids=()
- thread() {
- local this
- while [ ${#} -gt 6 ]; do
- this=${1}
- wait "$this"
- shift
- done
- pids=($1 $2 $3 $4 $5 $6)
- }
- for i in 1 2 3 4 5 6 7 8 9 10
- do
- <<< COMMAND >>> &
- pids=( ${pids[@]-} $(echo $!) )
- thread ${pids[@]}
- done
- for pid in ${pids[@]}
- do
- wait "$pid"
- done
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement