try using a file

This commit is contained in:
Heavybullets8 2022-08-21 22:26:06 -06:00
parent cc43fb1983
commit ed96807938

View File

@ -31,15 +31,12 @@ do
# readarray -t containers <<<"$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" # readarray -t containers <<<"$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")"
# continue # continue
# fi # fi
printf '%s\0' "${containers[@]}" | grep -Fxqz -- "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" && continue # 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//')") "$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")" >> containers
done done
mapfile -t containers < <(echo "${containers[*]}")
for i in "${containers[@]}" cat containers
do
echo "$i"
done
printf '%s \n' "${containers[@]}"
case "${#containers[@]}" in case "${#containers[@]}" in
0) 0)
echo -e "No containers available\nAre you sure the application in running?" echo -e "No containers available\nAre you sure the application in running?"