testing cmd-to-container

This commit is contained in:
Heavybullets8 2022-08-21 21:31:01 -06:00
parent 846ea6011e
commit 7af36bb1a4

View File

@ -27,10 +27,10 @@ mapfile -t pod_id < <(k3s crictl pods -s ready --namespace ix | grep -E "[[:spac
search=$(k3s crictl ps -a -s running | sed -E 's/[[:space:]]([0-9]*|About)[a-z0-9 ]{5,12}ago[[:space:]]//')
for pod in "${pod_id[@]}"
do
if [[ $(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r " | wc -l) -gt 1 ]]; then
readarray -t containers <<<"$(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r ")"
continue
fi
# if [[ $(echo "$search" | grep "$pod" | awk '{print $4}' | tr -d " \t\r " | wc -l) -gt 1 ]]; then
# 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}' | tr -d " \t\r ")")