Read arrays cleanly

This commit is contained in:
Ohad Livne 2026-01-28 02:20:09 +02:00
parent aa92f5c88a
commit 445e653d22
Signed by: libohad-dev
GPG key ID: 34FDC68B51191A4D
2 changed files with 5 additions and 4 deletions

View file

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

View file

@ -63,7 +63,7 @@ fi
editor_cmd="$(default_editor)"
echo "Editing using the command \"${editor_cmd}\""
IFS=' ' read -r -a editor <<< "${editor_cmd}"
IFS=' ' readarray -t editor <<< "${editor_cmd}"
orig_file="$1"
tempfile="$(mktemp)"