Last active
April 23, 2018 10:54
-
-
Save nsmith-/d13973adfb9bd06d23ab to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
for i in {1..10}; do | |
echo 'Sleeping' $i | |
sleep $i & | |
# prevent more than 5 tasks at a time | |
while [[ `jobs|wc -l` -gt 4 ]]; do sleep 1; done; | |
done | |
wait |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment