From d6e4ddd4d48b6ac9c0a29b95e0e2fc0e6012d725 Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Fri, 5 Jan 2024 20:38:58 -0800 Subject: 52465: use NULL_GLOB when expanding zmv input pattern to avoid NOMATCH exit --- Functions/Misc/zmv | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Functions') 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, -- cgit 1.4.1