From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26147 invoked by alias); 29 May 2015 19:34:07 -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: 35331 Received: (qmail 29805 invoked from network); 29 May 2015 19:34:03 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 Message-ID: <5568BF27.80806@inlv.org> Date: Fri, 29 May 2015 21:33:59 +0200 From: Martijn Dekker User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: zsh-workers@zsh.org Subject: Re: Arith parsing bug with minus after $# References: <55676FB1.9080401@inlv.org> <20150529160237.6f329071@pwslap01u.europe.root.pri> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Bart Schaefer schreef op 29-05-15 om 20:09: > On May 29, 2015 8:02 AM, "Peter Stephenson" > wrote: >> The problem is the overloading of "#" --- the test to establish what to >> do with it is trying too hard to resolve to ${#-}, which is a valid >> substitution, because it hasn't taken into account that there are no >> braces. So what you're seeing is ${#-}1. > > I think this actually was discussed on austin-group a few months back. My > recollection is that zsh's behavior was deemed permissible and I therefore > thought no more about it at the time. It is incompatible with every other shell and with the POSIX spec. Parameter expansion is only supposed to be done if braces are present. See: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02 - M.