aboutsummaryrefslogtreecommitdiffstats
path: root/test2.sh
blob: c4d433a4c55e9678f6547f680740c965cd278b5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/bash

set -eux

maxprocs=2
while true; do
    read filename <fifo
    sh -c "sleep 10; echo 'done: $filename'" &
    if test "$(jobs | wc -l)" -ge $maxprocs; then
        wait
    fi
    sleep 1
done