From 4fe1589aef2d62ab4550d7fd1e253f8f8080bb58 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 24 Jul 2022 23:12:15 -0600 Subject: [PATCH] proccount --- functions/update_apps.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 7af4f387..2c01edb0 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -11,12 +11,14 @@ count=0 for i in "${array[@]}" do update_apps "$i" & - (( count++ )) processes+=($!) - while [[ "$count" -ge "$update_limit" ]] + proc_count=0 + while [[ "${#processes[@]}" -ge "$update_limit" ]] do echo "waiting for free space" - wait -n "${processes[@]}" &> /dev/null && (( count-- )) + wait -n "${processes[$proc_count]}" &> /dev/null + (( proc_count++ )) + unset "processes[$proc_count]" done done