zsh-workers
 help / color / mirror / code / Atom feed
From: Jilles Tjoelker <jilles@stack.nl>
To: Zsh Hackers' List <zsh-workers@zsh.org>
Subject: Re: sh compatibility issue
Date: Sun, 20 Feb 2011 00:05:40 +0100	[thread overview]
Message-ID: <20110219230540.GA81416@stack.nl> (raw)
In-Reply-To: <20110218103012.27fd1869@pwslap01u.europe.root.pri>

> !(...) without space

I think the POSIX spec requires this to work, but that may not be
intentional. '(' is an operator and therefore it does not need a space
between it and other characters (except to disambiguate between two
adjacent operators and one two-character operator). It may not be
intentional because it conflicts with ksh extended pattern matching.

More generally, this rule also means that things like
  while(true)do(pwd)done
do not need any spaces. Although this example is contrived, I can
imagine there are real scripts that zsh fails to parse because of this;
the other shells I tried execute it correctly.

The situation for '!{' is different. '{' is a reserved word and
therefore it is not recognized. Instead, this describes a utility (or
alias) that probably does not exist. I do not recommend making special
allowances for it.

On a related note, here is another quite insidious sh compatibility
issue:
  sh -c 'exec </nonexistent/a; echo wrong'
This should not print "wrong" because exec is a special builtin and
redirection errors on special builtins are fatal. Most shells get this
right nowadays (bash only in POSIX mode) but zsh gets it wrong. Even
  set -o posixbuiltins
does not help.

-- 
Jilles Tjoelker


  parent reply	other threads:[~2011-02-19 23:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-18  3:55 Vincent Stemen
2011-02-18 10:30 ` Peter Stephenson
2011-02-18 22:45   ` Vincent Stemen
2011-02-19 23:05   ` Jilles Tjoelker [this message]
2011-02-20  0:41     ` Vincent Stemen
2011-02-20 19:11     ` Peter Stephenson
2011-02-20 20:17       ` Peter Stephenson
2011-02-20 21:12         ` Vincent Stemen
     [not found]       ` <4D618A11.3050406@case.edu>
2011-02-22 20:02         ` Peter Stephenson
2011-02-23  1:08           ` Vincent Stemen
2011-02-23  1:51             ` Bart Schaefer
2011-02-23  2:30               ` Vincent Stemen
2011-02-23  9:25               ` Peter Stephenson
2011-03-04 13:36           ` Jilles Tjoelker
2011-03-06 20:26             ` Peter Stephenson

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=20110219230540.GA81416@stack.nl \
    --to=jilles@stack.nl \
    --cc=zsh-workers@zsh.org \
    /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).