Skip to content

Instantly share code, notes, and snippets.

@dentearl
dentearl / gist:3278446
Last active May 8, 2020
bash loop to run tons of jobs but limit the background to a certain smaller number at a time. change the -gt 0 to be -gt _n_ to limit the number of background jobs to _n_
View gist:3278446
# primate version
for f in ../packagePrimates/analysis/comparatorWrapper-primates.*/; do
for c in A B C D; do
##########
# This block holds the background process count in check
while [ $(jobs | wc -l) -gt 0 ]; do
sleep 2;
done;
##########
for partner in simChimp simGorilla simOrang; do