From 84a415c39dfe3c11853113ad8aad8589b9ae47d1 Mon Sep 17 00:00:00 2001 From: "D. Ben Knoble" Date: Mon, 3 Jun 2024 11:07:20 -0400 Subject: [PATCH] build(foreach): handle arguments robustly Fix some shellcheck warnings and, more importantly, handle the arguments more robustly by not word-splitting arguments. An invocation like foreach F "a b" c would have run `F a; F b; F c`. Make it run `F "a b"; F c` as expected. --- build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 06b14e8..121599d 100755 --- a/build.sh +++ b/build.sh @@ -118,8 +118,8 @@ build_6x_7x_old () { foreach () { declare -r command="${1}"; - declare -r args="${@:2}"; - for _arg in ${args}; do + declare -r args=("${@:2}"); + for _arg in "${args[@]}"; do "${command}" "${_arg}"; done; };