zsh-users
 help / color / mirror / code / Atom feed
From: segal@morgan.com (Morris M. Siegel)
To: Zoltan Hidvegi <hzoli@cs.elte.hu>
Cc: zsh-users@math.gatech.edu
Subject: Re: Suggested "case" syntax extension
Date: Tue, 9 Jul 1996 16:09:07 -0400	[thread overview]
Message-ID: <9607091609.ZM9713@morgan.com> (raw)
In-Reply-To: Zoltan Hidvegi <hzoli@cs.elte.hu> "Re: Suggested "case" syntax extension" (Jul  9,  2:33am)

On Jul 9,  2:33am, Zoltan Hidvegi wrote:
> Subject: Re: Suggested "case" syntax extension
> > Newer versions of ksh allow an optional '(' before each pattern in a case
> > statement, complementary to the mandatory ')' following the pattern.  As
> > well as being esthetically symmetric, this also facilitates verifying that
> > a shell script has balanced parentheses (e.g. with the '%' command in vi).
> >
> > It seems that zsh still recognizes only the classic Bourne shell syntax for
> > "case", with the ')' but no optional '('.  Considering all the syntactic
> > variation zsh supports, it would be quite reasonable for zsh to allow a
> > leading '(', thereby enhancing compatibility with ksh scripts.  Although
> > I have not looked into the zsh source, I imagine this should not pose an
> > implementation problem.
>
> Zsh accepts an optional leading '(' since 2.6-beta21.  POSIX 1003.2
> requires this.  It also allows us to use case sttement in $(...) command
> substitutions (of course even a normal case should work in a command
> substitution but the zsh implementation requires ballanced parentheses like
> bash and pdksh).
>
> Zsh is not completely ksh compatible here since due to the enhanced glob
> pattern syntax recognized by zsh if there is a leading '(' the closing ')'
> must be delimited with a blank from the command following that.  So
>
> case foo in
> (f*)echo yes;;
> (*)echo no;;
> esac
>
> does not work in zsh but
>
> case foo in
> (f*) echo yes;;
> (*) echo no;;
> esac
>
> works.
>
> Zoltan
>-- End of excerpt from Zoltan Hidvegi
______________________________________

I'm glad to learn this has already been implemented.  (The last time I tried it
was with 2.6-beta20, I believe.)  However, I double-checked in the zsh-3.0-pre2
distribution, and both man/man1/zshmisc.1 and Doc/zshmisc.man lack any mention
of an optional leading '('.  This should be fairly easy to remedy.

-- Morrie Siegel



  reply	other threads:[~1996-07-09 20:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-07-08 23:46 Morris M. Siegel
1996-07-09  0:33 ` Zoltan Hidvegi
1996-07-09 20:09   ` Morris M. Siegel [this message]
1996-07-09 21:07     ` Zoltan Hidvegi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9607091609.ZM9713@morgan.com \
    --to=segal@morgan.com \
    --cc=hzoli@cs.elte.hu \
    --cc=zsh-users@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).