From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29271 invoked from network); 13 Apr 2004 17:18:58 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 13 Apr 2004 17:18:58 -0000 Received: (qmail 8101 invoked by alias); 13 Apr 2004 17:18:37 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7345 Received: (qmail 8072 invoked from network); 13 Apr 2004 17:18:36 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 13 Apr 2004 17:18:36 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [130.225.247.86] by sunsite.dk (MessageWall 1.0.8) with SMTP; 13 Apr 2004 17:18:36 -0000 Received: (qmail 12988 invoked from network); 13 Apr 2004 17:18:35 -0000 Received: from wbar3.sjo1-4-11-009-147.sjo1.dsl-verizon.net (HELO candle.brasslantern.com) (4.11.9.147) by a.mx.sunsite.dk with SMTP; 13 Apr 2004 17:18:33 -0000 Received: (from schaefer@localhost) by candle.brasslantern.com (8.11.6/8.11.6) id i3DHIVB20963 for zsh-users@sunsite.dk; Tue, 13 Apr 2004 10:18:31 -0700 X-Authentication-Warning: candle.brasslantern.com: schaefer set sender to schaefer@closedmail.com using -f From: Bart Schaefer Message-Id: <1040413171831.ZM20962@candle.brasslantern.com> Date: Tue, 13 Apr 2004 17:18:31 +0000 In-Reply-To: Comments: In reply to Lloyd Zusman "Re: Subscripting without temporaries" (Apr 13, 12:40pm) References: <20040413120053.GA4420@DervishD> <040413082948.ZM20696@candle.brasslantern.com> X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-users@sunsite.dk Subject: Re: Subscripting without temporaries MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: **** X-Spam-Status: No, hits=4.7 required=6.0 tests=RCVD_IN_DYNABLOCK, RCVD_IN_NJABL,RCVD_IN_NJABL_DIALUP,RCVD_IN_SORBS autolearn=no version=2.63 X-Spam-Hits: 4.7 On Apr 13, 12:40pm, Lloyd Zusman wrote: } } > txt="Some text [particular text] Another text" } > print -l $txt[1,$txt[(i)\[]-2] $txt[(r)\[,(R)\]] $txt[$txt[(I)\]]+2,-1] } } This is cool. But what options are necessary in order to make this } work? The commands above produce this output for me: } } Some } text } [particular } text] } Another } text unsetopt shwordsplit or place each of the $txt[...] in double quotes: print -l "$txt[1,$txt[(i)\[]-2]" "$txt[(r)\[,(R)\]]" "$txt[$txt[(I)\]]+2,-1]" You'll find that many examples posted to zsh-users assume that arrays are superior to strings-automatically-split-at-spaces, and therefore assume that you're using the default zsh setting of no_shwordsplit. -- 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