zsh-users
 help / color / mirror / code / Atom feed
From: Zoltan Hidvegi <hzoli@cs.elte.hu>
To: segal@morgan.com (Morris M. Siegel)
Cc: zsh-users@math.gatech.edu, segal@morgan.com
Subject: Re: Suggested "case" syntax extension
Date: Tue, 9 Jul 1996 02:33:06 +0200 (MET DST)	[thread overview]
Message-ID: <199607090033.CAA11237@bolyai.cs.elte.hu> (raw)
In-Reply-To: <9607081946.ZM7325@morgan.com> from "Morris M. Siegel" at "Jul 8, 96 07:46:21 pm"

> 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



  reply	other threads:[~1996-07-09  0:42 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 [this message]
1996-07-09 20:09   ` Morris M. Siegel
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=199607090033.CAA11237@bolyai.cs.elte.hu \
    --to=hzoli@cs.elte.hu \
    --cc=segal@morgan.com \
    --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).