From ed96807938053d0ccb1b0a8aa45276f3e48448af Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Sun, 21 Aug 2022 22:26:06 -0600 Subject: [PATCH] try using a file --- functions/cmd_to_container.sh | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index d4a1d79e..19e4a7a3 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -31,15 +31,12 @@ do # readarray -t containers <<<"$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" # continue # fi - printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue - containers+=("$(echo "$search" | grep "$pod" | awk '{print $4}' | sed 's/ /\n//')") + # printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue + "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" >> containers done -mapfile -t containers < <(echo "${containers[*]}") -for i in "${containers[@]}" -do - echo "$i" -done -printf '%s \n' "${containers[@]}" + +cat containers + case "${#containers[@]}" in 0) echo -e "No containers available\nAre you sure the application in running?"