From 3eae25deded291726587a74f68f0a3292f11461f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 4 Aug 2022 18:23:15 -0600 Subject: [PATCH] test more aggressive loop --- functions/update_apps.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 421576e4..ab30afd2 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -25,9 +25,12 @@ do if [[ "$proc_count" -ge "$update_limit" ]]; then sleep 3 elif [[ $it -lt ${#array[@]} ]]; then - update_apps "${array[$it]}" & - processes+=($!) - ((it++)) + until [[ ${#processes[@]} -ge "$update_limit" || ${#processes[@]} -ge ${#array[@]} ]] + do + update_apps "${array[$it]}" & + processes+=($!) + ((it++)) + done elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish sleep 3 else # All processes must be completed, break out of loop