From a03598b1b7f45abd3072f8ad733f8e90a2b5cb8f Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Fri, 12 Aug 2022 09:13:37 -0600 Subject: [PATCH] do not add duplicate containers --- functions/cmd_to_container.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index d0a6c47b..277da7bb 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -27,6 +27,7 @@ search=$(k3s crictl ps -a -s running | sed -E 's/[[:space:]]([0-9]*|About)[a-z0- mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $(NF)}') for pod in "${pod_id[@]}" do + printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}')" && continue containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}')") done case "${#containers[@]}" in