Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
negative pattern doesn't match empty string in globbing?
- X-seq: zsh-users 19110
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: "zsh-users@xxxxxxx" <zsh-users@xxxxxxx>
- Subject: negative pattern doesn't match empty string in globbing?
- Date: Fri, 19 Sep 2014 10:55:02 +0100
- In-reply-to: <20140919080426.GA4265@localhost.localdomain>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20140919080426.GA4265@localhost.localdomain>
On Friday, 19 September 2014, Han Pingtian <hanpt@xxxxxxxxxxxxxxxxxx
<javascript:_e(%7B%7D,'cvml','hanpt@xxxxxxxxxxxxxxxxxx');>> wrote:
> Hello,
>
> I just notice that negative pattern like this doesn't work:
>
> localhost% setopt extendedglob
> localhost% print /usr/**/bin/zsh
> /usr/bin/zsh /usr/local/bin/zsh
> localhost% print /usr/^local/bin/zsh
> zsh: no matches found: /usr/^local/bin/zsh
> localhost% ls /usr//bin/zsh
> /usr//bin/zsh
> localhost%
>
> I think if "^local" can match with empty string, then this should work.
> But looks like it doesn't.
Please excuse formatting, I'm writing this on my phone at a
bus stop, or at least trying. (I'm now half way to Truro and
on the third browser...)
Negative patterns are confusing, I've discovered over the years.
The way to think of them is "match anything but..."
In other words, first match something, and only then decide
what to exclude.
In this case, the initial "match anything" matches files in the directory
you've reached. Obviously there is no empty file. So the overall match fails
at that point.
Phew... time to hit send...
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author