Created
February 28, 2020 18:02
-
-
Save laztname/083c326ca6403493ba95da6db750667d to your computer and use it in GitHub Desktop.
parallel against time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pwait() { | |
while [ $(jobs -p | wc -l) -ge $1 ]; do | |
sleep 1 | |
done | |
} | |
for i in $(cat list.txt); do | |
do_the_jobs & | |
pwait 6 # 6 = max thread | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment