1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-27 16:50:58 +01:00

users/18857: add (Y) glob qualifier to generate only one match per pattern

This commit is contained in:
Daniel Shahaf 2014-06-01 14:18:21 -07:00 committed by Barton E. Schaefer
parent 501f2003a8
commit 10ae77c0cf
4 changed files with 44 additions and 11 deletions

View file

@ -431,6 +431,7 @@
mkdir glob.tmp/dir5
touch glob.tmp/dir5/N123
print glob.tmp/dir5/N<->(N)
rm -rf glob.tmp/dir5
0:Numeric glob is not usurped by process substitution.
>glob.tmp/dir5/N123
@ -541,3 +542,13 @@
>No file beginning with z
>Multiple files matched
>Normal string if nullglob not set
(){ print $#@ } glob.tmp/dir*(Y)
(){ print $#@ } glob.tmp/file*(NY)
(){ [[ $1 = glob.tmp/dir? ]] && echo "(Y) returns a matching filename" } glob.tmp/dir*(Y)
(){ print $@:t } glob.tmp/dir*(Y^Y)
0:short-circuit modifier
>1
>0
>(Y) returns a matching filename
>dir1 dir2 dir3 dir4