From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6502 invoked from network); 13 Sep 2000 18:45:24 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 13 Sep 2000 18:45:24 -0000 Received: (qmail 27711 invoked by alias); 13 Sep 2000 18:44:45 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 12799 Received: (qmail 27704 invoked from network); 13 Sep 2000 18:44:44 -0000 Date: Wed, 13 Sep 2000 14:44:41 -0400 Message-Id: <200009131844.OAA01710@soup.ads.apexinc.com> X-Authentication-Warning: soup.ads.apexinc.com: ejb set sender to ejb@apexinc.com using -f From: "E. Jay Berkenbilt" To: zsh-workers@sunsite.auc.dk Subject: 3.1.9-dev-6: bug or confusion? Mime-Version: 1.0 (generated by tm-edit 7.106) Content-Type: text/plain; charset=US-ASCII Define these two functions: function okay { emulate -L zsh echo ${#${@:#-}} setopt localoptions xtrace (( ${#${@:#-}} )) } function broken { emulate -L zsh echo ${#${@#-}} setopt localoptions xtrace (( ${#${@#-}} )) } Notice that the only difference between these two functions is that one uses :# (match whole word) and the other uses # (match beginning of word) as applied to each element of $@. Then run zsh% okay - You get the expected output: 0 +okay:5> (( 0 )) Now run zsh% broken - You get the unexpected (by me anyway) output: 0 +broken:5> (( 1 )) Why would the value be 1 inside (( ... )) and 0 outside in the second case but not in the first? Does it have something to do with an empty string being counted as a word in one case but not the other? Is it a bug? If not, I'd be grateful if someone could explain this behavior. -- E. Jay Berkenbilt (ejb@ql.org) | http://www.ql.org/q/