From 86649fb0fed250004e0a1333b7abf24ecaaf5ffd Mon Sep 17 00:00:00 2001 From: mag37 Date: Mon, 22 Apr 2024 21:08:02 +0200 Subject: [PATCH] re-written sorting of arrays --- dockcheck.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/dockcheck.sh b/dockcheck.sh index cb5cc55..d8d384a 100755 --- a/dockcheck.sh +++ b/dockcheck.sh @@ -240,11 +240,10 @@ for i in $(docker ps $Stopped --filter "name=$SearchName" --format '{{.Names}}') done ### Sort arrays alphabetically -IFS=$'\n' -NoUpdates=($(sort <<<"${NoUpdates[*]}")) -GotUpdates=($(sort <<<"${GotUpdates[*]}")) -GotErrors=($(sort <<<"${GotErrors[*]}")) -unset IFS +readarray -td '' NoUpdates < <(printf '%s\0' "${NoUpdates[@]}" | sort -z -n) +readarray -td '' GotUpdates < <(printf '%s\0' "${GotUpdates[@]}" | sort -z -n) +readarray -td '' GotErrors < <(printf '%s\0' "${GotErrors[@]}" | sort -z -n) + ### Define how many updates are available UpdCount="${#GotUpdates[@]}"