diff --git a/functions/cmd_to_container.sh b/functions/cmd_to_container.sh index e5ae6e7b..1428c4a1 100644 --- a/functions/cmd_to_container.sh +++ b/functions/cmd_to_container.sh @@ -23,13 +23,13 @@ do fi done app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') -search=$(k3s crictl ps -a -s running) +search=$(k3s crictl ps -a -s running | sed -E 's/([0-9]*|About)[[:space:]](an|hours)[[:space:]](hour)?[[:space:]]?ago//') mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $(NF)}') [[ "${#pod_id[@]}" == 0 ]] && echo -e "No containers available\nAre you sure the application in running?" && exit containers=$( for pod in "${pod_id[@]}" do - echo "$search" | grep "$pod" | awk '{print $7}' + echo "$search" | grep "$pod" | awk '{print $4}' done | nl -s ") " | column -t) while true do