From 04c0a983a2fc9b0ca67a63d67f2ed348d0d3788a Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Wed, 10 Aug 2022 17:13:48 -0600 Subject: [PATCH] pod id and container check --- functions/cmd_to_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index 5ce76e68..00c0e6d5 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -30,7 +30,7 @@ do mapfile -t containers < <(echo "$search" | grep "$pod" | awk '{print $4}') done -if [[ "${#containers[@]}" == 1 ]]; then +if [[ "${#containers[@]}" == 1 && "${#pod_id[@]}" == 1 ]]; then container=$(echo "$search" | grep "${pod_id[*]}" | awk '{print $4}') container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}') elif [[ "${#containers[@]}" == 0 ]]; then