My question is how change this code so it will use only 4 threads/sub-processes?
TESTS="a b c d e"
for f in $TESTS; do
t=$[ ( $RANDOM % 5 ) + 1 ]
sleep $t && echo $f $t &
done
wait
My question is how change this code so it will use only 4 threads/sub-processes?
TESTS="a b c d e"
for f in $TESTS; do
t=$[ ( $RANDOM % 5 ) + 1 ]
sleep $t && echo $f $t &
done
wait
This is my "parallel" unzip loop using bash on AIX:
for z in *.zip ; do
7za x $z >/dev/null
while [ $(jobs -p|wc -l) -ge 4 ] ; do
wait -n
done
done
Notes: