summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart Schaefer <schaefer@zsh.org>2024-05-24 19:24:23 -0700
committerBart Schaefer <schaefer@zsh.org>2024-05-24 19:24:23 -0700
commit300ce96080b0679038db946ef34ac5c2d26646b5 (patch)
treef8580315cad1b0f7860f01bc3c0904de61c46b9e
parent7f196de9d7f1034a6a8cc7730280f21f7eb0a7f3 (diff)
downloadzsh-300ce96080b0679038db946ef34ac5c2d26646b5.tar.gz
zsh-300ce96080b0679038db946ef34ac5c2d26646b5.zip
52910: Improve handling of **/ patterns
-rw-r--r--ChangeLog2
-rw-r--r--Functions/Misc/zmv6
2 files changed, 5 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 642b40821..7f3412f8e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2024-05-24 Bart Schaefer <schaefer@zsh.org>
+ * 52910: Functions/Misc/zmv: Improve handling of **/ patterns
+
* 52904: Completion/Unix/Command/_git: Improve quoting of paths
passed via _call_program to "git ls-files"
diff --git a/Functions/Misc/zmv b/Functions/Misc/zmv
index 5c03e9ea1..2002af5a6 100644
--- a/Functions/Misc/zmv
+++ b/Functions/Misc/zmv
@@ -249,13 +249,13 @@ errs=()
(( ${#files} )) || errs=( "no files matched \`$fpat'" )
for f in $files; do
- if [[ $pat = (#b)(*)\(\*\*##/\)(*) ]]; then
+ if [[ $pat = (#b)(*)(\(\*\*##/\)|\*\*##/)(*) ]]; then
# This looks like a recursive glob. This isn't good enough,
- # because we should really enforce that $match[1] and $match[2]
+ # because we should really enforce that $match[1] and $match[3]
# don't match slashes unless they were explicitly given. But
# it's a start. It's fine for the classic case where (**/) is
# at the start of the pattern.
- pat="$match[1](*/|)$match[2]"
+ pat="$match[1](*/|)$match[3]"
fi
[[ -e $f && $f = (#b)${~pat} ]] || continue
set -- "$match[@]"