summaryrefslogtreecommitdiff
path: root/Functions/Misc/zmv
diff options
context:
space:
mode:
authorJoe Rayhawk <jrayhawk@fairlystable.org>2025-04-30 02:07:56 -0700
committerJoe Rayhawk <jrayhawk@fairlystable.org>2025-04-30 02:07:56 -0700
commit26e09889646be3ea65b4a3dfeda26213e4bb6a27 (patch)
tree4f3c73a9416bf47ad7e125383d23cf42879e38d7 /Functions/Misc/zmv
parent841bce705a58b04220b1f257abcc00ae71cbdbdc (diff)
parent001cba48ce3b964cf01fb3e2af54b20eacbc9bf5 (diff)
downloadzsh-26e09889646be3ea65b4a3dfeda26213e4bb6a27.tar.gz
zsh-26e09889646be3ea65b4a3dfeda26213e4bb6a27.zip
Merge branch 'upstream' into debian
Diffstat (limited to 'Functions/Misc/zmv')
-rw-r--r--Functions/Misc/zmv14
1 files changed, 10 insertions, 4 deletions
diff --git a/Functions/Misc/zmv b/Functions/Misc/zmv
index 269fe5ba5..2002af5a6 100644
--- a/Functions/Misc/zmv
+++ b/Functions/Misc/zmv
@@ -236,20 +236,26 @@ if [[ $pat = (#b)(*)\((\*\*##/)\)(*) ]]; then
else
fpat=$pat
fi
-files=(${~fpat})
[[ -n $hasglobqual ]] && pat=$opat
errs=()
+() {
+ # (#qN) breaks bareglobqual -Q option, so:
+ setopt localoptions nullglob
+ files=(${~fpat})
+}
+(( ${#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[@]"