Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Inconsistent behavior with comparisons and recursive glob patterns
- X-seq: zsh-workers 52912
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: Alan Wagner-Krankel <awk@xxxxxxxxxxx>, zsh-workers@xxxxxxx
- Subject: Re: Inconsistent behavior with comparisons and recursive glob patterns
- Date: Wed, 1 May 2024 09:38:48 +0100 (BST)
- Archived-at: <https://zsh.org/workers/52912>
- Importance: Normal
- In-reply-to: <CAGZNKj+TUjbmJLBWV7Rysh0Bs5h=n1e74ukb0rsQye5+5=jBcQ@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAGZNKjL2cJhLopFPAFFTewh2cHxX+_L4vMx2Nf9bAS0ud58RBw@mail.gmail.com> <c97c8fe9-2f56-45b7-bfb2-9f2a97283859@gmx.com> <CAGZNKj+TUjbmJLBWV7Rysh0Bs5h=n1e74ukb0rsQye5+5=jBcQ@mail.gmail.com>
> On 01/05/2024 08:55 BST Alan Wagner-Krankel <awk@xxxxxxxxxxx> wrote:
> Thanks - I did miss that **/ wasn't supported in conditional expressions.
>
> I wonder if there might be some value in making that explicit in the
> documentation, possibly by changing the paragraph you referenced to
> something like this:
>
> Pattern metacharacters are active for the pattern arguments. The patterns
> are the same as those used for filename generation, see zshexpn(1), but
> there is no special behaviour of `/' nor initial dots, shorthand operators
> such as **/ are not converted to their expanded forms, and glob qualifiers
> are only allowed for forcing filenames to be generated as described above.
>
> There's a slight issue that "such as **/" implies there are many
> shorthand operators; I have no idea if there are any others besides
> **/ and ***/.
That's a sensible suggestion, how about this? Please do comment further.
pws
diff --git a/Doc/Zsh/cond.yo b/Doc/Zsh/cond.yo
index 000e576..4216f89 100644
--- a/Doc/Zsh/cond.yo
+++ b/Doc/Zsh/cond.yo
@@ -241,7 +241,10 @@ ifnzman(\
noderef(Filename Generation)\
)\
, but there is no special behaviour
-of `tt(/)' nor initial dots, and no glob qualifiers are allowed.
+of `tt(/)' nor initial dot, and the patterns `tt(**/)' and `tt(***/)' behave
+the same as (*/), in which the tt(*) may match one or more `tt(/)' characters.
+Also, no bare glob qualifiers are allowed, though the form `(#q)var(...)' is
+allowed as shown above.
In each of the above expressions, if
var(file) is of the form `tt(/dev/fd/)var(n)',
Messages sorted by:
Reverse Date,
Date,
Thread,
Author