From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28090 invoked by alias); 20 Feb 2011 00:41:32 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 28781 Received: (qmail 618 invoked from network); 20 Feb 2011 00:41:30 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at hightek.org does not designate permitted sender hosts) Date: Sat, 19 Feb 2011 18:41:23 -0600 From: Vincent Stemen To: zsh-workers@zsh.org Subject: Re: sh compatibility issue Message-ID: <20110220004122.GA86560@quark.hightek.org> References: <20110218103012.27fd1869@pwslap01u.europe.root.pri> <20110219230540.GA81416@stack.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110219230540.GA81416@stack.nl> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: Vincent Stemen On Sun, Feb 20, 2011 at 12:05:40AM +0100, Jilles Tjoelker wrote: > > !(...) 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 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 Interesting. I ran these two tests tests with sh, ksh, bash, and zsh. while(true)do(pwd)done This worked in sh, ksh, and bash. It failed only in zsh. sh -c 'exec