From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13524 invoked by alias); 30 May 2015 19:33:33 -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: 35340 Received: (qmail 26233 invoked from network); 30 May 2015 19:33:28 -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,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.0 X-Originating-IP: [80.3.228.158] X-Spam: 0 X-Authority: v=2.1 cv=TYVrzkkh c=1 sm=1 tr=0 a=P+FLVI8RzFchTbbqTxIDRw==:117 a=P+FLVI8RzFchTbbqTxIDRw==:17 a=IkcTkHD0fZMA:10 a=NLZqzBF-AAAA:8 a=q2GGsy2AAAAA:8 a=vaJtXVxTAAAA:8 a=_zYOrkxVS-hTR9Frp_0A:9 a=VGl79oLGdJJlR6vM:21 a=knB7_cADUZPujQvC:21 a=QEXdDO2ut3YA:10 Date: Sat, 30 May 2015 20:24:12 +0100 From: Peter Stephenson To: Bart Schaefer , Zsh hackers list Subject: Re: Arith parsing bug with minus after $# Message-ID: <20150530202412.2ff6de78@ntlworld.com> In-Reply-To: References: <55676FB1.9080401@inlv.org> <20150529160237.6f329071@pwslap01u.europe.root.pri> <5568BF27.80806@inlv.org> <5423831432932500@web1o.yandex.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, 29 May 2015 14:24:45 -0700 Bart Schaefer wrote: > On May 29, 2015 1:54 PM, "ZyX" wrote: > > > > But later it explicitly says that not enclosed in single braces may only > be names or single-character variables. I.e. $#- is ${#}-, $10 is ${1}0, = =E2=80=A6 >=20 > Yes, but $#name to return the length of the value of $name is already a z= sh > extension, so unless we're in some emulation mode, treating $#- as the > length of $- is perfectly reasonable. Perhaps more interesting is $#*, since "*" is a much more commmon special parameter that's also an operator, and isn't quite so horrifically overloaded in parameter substitution. % emulate sh -c 'fn() { echo $(( $#*3 )); }' % fn one 13 That looks like it needs some emulation, though it can wait since nobody's tripped over it. I'm not agonizing much over the extremely rare and confusing $#-, to be honest. pws