Update lxc-delete.sh

This commit is contained in:
CanbiZ 2025-05-07 09:41:23 +02:00
parent 6bdb1e28df
commit 2ca445cea3

View File

@ -50,7 +50,7 @@ if [ -z "$containers" ]; then
exit 1
fi
menu_items=()
menu_items=("ALL" "Delete ALL containers" "OFF") # Add as first option
FORMAT="%-10s %-15s %-10s"
while read -r container; do
@ -76,6 +76,11 @@ DELETE_MODE=${DELETE_MODE:-m}
selected_ids=$(echo "$CHOICES" | tr -d '"' | tr -s ' ' '\n')
# If "ALL" is selected, override with all container IDs
if echo "$selected_ids" | grep -q "^ALL$"; then
selected_ids=$(echo "$containers" | awk '{print $1}')
fi
for container_id in $selected_ids; do
status=$(pct status $container_id)