Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: bracket expressions and POSIX
- X-seq: zsh-workers 15190
- From: Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx (Zsh hackers list)
- Subject: Re: bracket expressions and POSIX
- Date: Sat, 30 Jun 2001 20:00:34 +0100
- In-reply-to: "Clint Adams"'s message of "Fri, 29 Jun 2001 14:22:15 EDT." <20010629142215.A8431@xxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
Clint Adams wrote:
> POSIX says that \ loses its special meaning within a bracket
> expression for pattern matching and also that ! is the
> ^ character in that context.
>
> So this strikes me as non-compliant:
>
> % emulate sh
> % touch \\test abc
> % echo [!a]*
> zsh: event not found: a]
We can't do much directly about this (i.e. with BANG_HISTORY), as Bart
pointed out.
> % echo [\!a]*
> \test
Ooh err. I don't like that one at all.
> % echo [\]*
> []*
> % echo [\\]*
> \test
These are non-compliant, but it's actually useful being able to quote
things in a range with a backslash, particularly square brackets, rather
than rely on the rather tricky rules of positioning (anyone remember off
the top of their head how to match both a `]' and a `-'?). I hope
it will be possible to turn this into an option (part of SH_GLOB?) by
un-nulling the backslashes. It's possible the extra test could make a
noticeable effect on the speed of pattern compilation, but again I hope
not. I haven't looked at the code.
--
Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx>
Work: pws@xxxxxxx
Web: http://www.pwstephenson.fsnet.co.uk
Messages sorted by:
Reverse Date,
Date,
Thread,
Author