cmd to container regex

This commit is contained in:
Heavybullets8 2022-08-12 08:10:15 -06:00
parent 0fbe428507
commit 7f6018b5d5

View File

@ -23,7 +23,7 @@ do
fi fi
done done
app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}') app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}')
search=$(k3s crictl ps -a -s running | sed -E 's/([0-9]*|About)[[:space:]][a-z]{2,5}[[:space:]](hour)?[[:space:]]?ago//') search=$(k3s crictl ps -a -s running | sed -E 's/[[:space:]]([0-9]*|About)[a-z0-9 ]{5,12}ago[[:space:]]//')
mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $(NF)}') mapfile -t pod_id < <(echo "$search" | grep -E "[[:space:]]$app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $(NF)}')
for pod in "${pod_id[@]}" for pod in "${pod_id[@]}"
do do