about summary refs log tree commit diff
path: root/Functions
diff options
context:
space:
mode:
authorBart Schaefer <schaefer@zsh.org>2024-01-05 20:38:58 -0800
committerBart Schaefer <schaefer@zsh.org>2024-01-05 20:38:58 -0800
commitd6e4ddd4d48b6ac9c0a29b95e0e2fc0e6012d725 (patch)
tree17e0b496d09c024cfa729eba8aee84c708a1b893 /Functions
parenta528af5c57436c730144e35d97547163c57c8420 (diff)
downloadzsh-d6e4ddd4d48b6ac9c0a29b95e0e2fc0e6012d725.tar.gz
zsh-d6e4ddd4d48b6ac9c0a29b95e0e2fc0e6012d725.tar.xz
zsh-d6e4ddd4d48b6ac9c0a29b95e0e2fc0e6012d725.zip
52465: use NULL_GLOB when expanding zmv input pattern to avoid NOMATCH exit
Diffstat (limited to 'Functions')
-rw-r--r--Functions/Misc/zmv8
1 files changed, 7 insertions, 1 deletions
diff --git a/Functions/Misc/zmv b/Functions/Misc/zmv
index 269fe5ba5..5c03e9ea1 100644
--- a/Functions/Misc/zmv
+++ b/Functions/Misc/zmv
@@ -236,12 +236,18 @@ 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
     # This looks like a recursive glob.  This isn't good enough,