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

Re: PATCH Re: [doogie@xxxxxxxxxxxxx: Bug#163237: zsh barfs on valid shell]

"Bart Schaefer" wrote:
> On Oct 3,  4:43pm, Clint Adams wrote:
> } Subject: [doogie@xxxxxxxxxxxxx: Bug#163237: zsh barfs on valid shell]
> }
> } This happens under emulate -R sh as well.
> } 
> } ----- Forwarded message from Adam Heath <doogie@xxxxxxxxxxxxx> -----
> } 
> } case foo in (foo)echo foo;;(bar)echo bar;;esac
> } zsh:zsh: parse error near `foo'
> This is because "(foo)echo" is being parsed as a file pattern [equivalent
> to "(foo|foo)echo" for those who don't immediately see why it's being
> parsed that way].
> This is an inherent ambiguity in using parens for pattern grouping and is
> going to have to stay the way it is when not in emulation mode.

An option `case_balance_parens' would be a possibility.  The reasoning
for this would be (1) balancing the parentheses is neater anyway, so
having a test to force better syntax is useful (2) inside $(...),
balancing is essential, so using the option makes it consistent.  It
couldn't be on by default, though, so you wouldn't get it with `emulate
zsh', which makes it less useful.

The SH_GLOB test is definitely better for Bourne-style use.

Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070

The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
If you received this in error, please contact the sender and 
delete the material from any computer.

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