Skip to content

Commit 84a415c

Browse files
committed
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.
1 parent 4d5a5e9 commit 84a415c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ build_6x_7x_old () {
118118

119119
foreach () {
120120
declare -r command="${1}";
121-
declare -r args="${@:2}";
122-
for _arg in ${args}; do
121+
declare -r args=("${@:2}");
122+
for _arg in "${args[@]}"; do
123123
"${command}" "${_arg}";
124124
done;
125125
};

0 commit comments

Comments
 (0)