Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: 'case' pattern matching bug with bracket expressions



On 5/14/15 12:17 PM, Peter Stephenson wrote:

> I don't *think* the following patch makes anything worse, but notice
> you're in any case on fairly soggy ground here, even in bash:
> 
> $ var=
> $ [[ ']' = [$var]*[$var] ]] && echo matches
> matches
> 
> and presumably Chet would agree with me that's required by the
> standard.

Yes, everybody matches `]' with that pattern.  Posix requires that the
`case' equivalent match (`[[' is not in the standard), since it specifies
the expansions that take place on the pattern before you attempt
matching using the pattern matching rules.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@xxxxxxxx    http://cnswww.cns.cwru.edu/~chet/



Messages sorted by: Reverse Date, Date, Thread, Author