dotfiles/.local/bin/clear-buildah
2026-02-07 00:34:49 +02:00

12 lines
298 B
Bash
Executable file

#! /usr/bin/bash
set -euo pipefail
IFS=$'\n\t'
containers_raw="$(buildah list | tail --lines +2 | cut --delimiter ' ' --fields 1)"
if [ -z "${containers_raw}" ]; then
echo "No containers to remove"
else
readarray -t containers <<< "${containers_raw}"
buildah rm "${containers[@]}"
fi