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

Re: 'case' pattern matching bug with bracket expressions

On 5/14/15 11:55 AM, Peter Stephenson wrote:

> It occurs to me that other shells will treat whitespace as ending a
> pattern for syntactic reasons, even if logically it can't:
> [[ ' ' = [ ] ]]
> works in zsh, but is a parse error in bash.

Because shell metacharacters delimit words.  The definition of a WORD
(and the use of WORDs as patterns) doesn't really change depending on
whether you're parsing a case command or a conditional command.

> (*) Relegated to a footnote because this is more of a rant than
> a useful comment:  furthermore, the whole []] thing is designed
> so that you *don't* need to quote characters in the [...].  So
> do you, or don't you?  Bleugh.

You do.  Conditional commands use the same definition of WORD tokens
as everything else.

``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