From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19219 invoked from network); 18 Apr 2001 08:34:14 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 18 Apr 2001 08:34:14 -0000 Received: (qmail 26837 invoked by alias); 18 Apr 2001 08:34:10 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 14010 Received: (qmail 26824 invoked from network); 18 Apr 2001 08:34:09 -0000 From: "Bart Schaefer" Message-Id: <1010418065750.ZM28885@candle.brasslantern.com> Date: Wed, 18 Apr 2001 06:57:49 +0000 In-Reply-To: <1010415080610.ZM10250@candle.brasslantern.com> Comments: In reply to "Bart Schaefer" "PATCH: Assorted parameter stuff" (Apr 15, 8:06am) References: <1010415080610.ZM10250@candle.brasslantern.com> <15067.48757.697880.303760@starf.org> <1010417044550.ZM14033@candle.brasslantern.com> In-Reply-To: <1010417044550.ZM14033@candle.brasslantern.com> Comments: In reply to "Bart Schaefer" "Re: Example from manual seems broken" (Apr 17, 4:45am) X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@sunsite.dk Subject: Re: PATCH: Assorted parameter stuff MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Apr 15, 8:06am, Bart Schaefer wrote: } } I'll hold off committing this until a couple of you have applied it } and say it seems OK. Everybody must be on spring break. On Apr 17, 4:45am, Bart Schaefer wrote: } } On Apr 16, 11:54pm, F. G. Marx wrote: } } } } then> print ${foo[$mbegin[1],$mend[1]]} } } $> zsh: bad math expression: operand expected at `$mend[1]' } } I don't know exactly why this was broken, but my patch in 13992 fixes it. } So maybe I should commit that patch after all. I've now got one additional thing fixed. In any version of zsh up to 4.0.1-pre-3, try this: % foo='any random string' % echo $foo[(i)ran 0(i)ran The correct output would be one of these: zsh: invalid subscript zsh: bad pattern: any random string[(i)ran zsh: bad pattern: string[(i)ran (shwordsplit) any random string[(i)ran (nobadpattern) It's fairly difficult to get zsh to treat that open-bracket as anything other than the start of a subscript, so the first of those is easiest, and is what I've done. However, that also means that: % echo $foo[ran zsh: invalid subscript In 4.0.1-pre-2 that gives `any random string[ran' (regardless of the setting of badpattern, which is arguably also wrong). One additional question: I think it'd be straightforward to make this be parsed as all one word: % echo $foo[(i)dom str] I.e. the space inside the [ ] could implicitly be quoted. Currently it's necessary to use "$foo[(i)dom str]" to get an embedded space in a subscript. I can't think of any way in which such a change would break a currently-working script. Is it worth trying? -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net