From 1bfbdaa12588b3ffa69eeb51ff10d96198bff3d1 Mon Sep 17 00:00:00 2001 From: jwerle Date: Wed, 13 Apr 2022 16:21:14 -0400 Subject: [PATCH] fix(bpkg-run): fix glob lookup in command runner --- lib/run/run.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/run/run.sh b/lib/run/run.sh index 07813c1..a8a5dda 100755 --- a/lib/run/run.sh +++ b/lib/run/run.sh @@ -115,7 +115,13 @@ bpkg_run () { for (( i = 1; i < ${#parts[@]}; i++ )); do if [[ "${parts[$i]}" =~ \*.\* ]]; then - args+=($(find . -path "${parts[$i]}")) + local found=($(find . -path "${parts[$i]}")) + if (( ${#found[@]} > 0 )); then + args+=("${found[@]}") + else + # shellcheck disable=SC2086 + args+=($($(which ls) ${parts[$i]} 2>/dev/null)) + fi else args+=("${parts[$i]}") fi @@ -192,7 +198,13 @@ bpkg_run () { for (( i = 1; i < ${#parts[@]}; i++ )); do if [[ "${parts[$i]}" =~ \*.\* ]]; then - args+=($(find . -wholename "${parts[$i]}")) + local found=($(find . -path "${parts[$i]}")) + if (( ${#found[@]} > 0 )); then + args+=("${found[@]}") + else + # shellcheck disable=SC2086 + args+=($($(which ls) ${parts[$i]} 2>/dev/null)) + fi fi done