From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8262 invoked from network); 13 Apr 2004 17:38:43 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 13 Apr 2004 17:38:43 -0000 Received: (qmail 23239 invoked by alias); 13 Apr 2004 17:38:27 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7346 Received: (qmail 24019 invoked from network); 13 Apr 2004 17:11:45 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 13 Apr 2004 17:11:45 -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:11:44 -0000 Received: (qmail 10061 invoked from network); 13 Apr 2004 17:11:44 -0000 Received: from parhelion.firedrake.org (mail@193.201.200.77) by a.mx.sunsite.dk with SMTP; 13 Apr 2004 17:11:43 -0000 Received: from phil by parhelion.firedrake.org with local (Exim 3.35 #1 (Debian)) id 1BDRRm-0007tO-00 for ; Tue, 13 Apr 2004 18:11:42 +0100 Date: Tue, 13 Apr 2004 19:11:42 +0200 From: Phil Pennock To: zsh-users@sunsite.dk Subject: Re: Subscripting without temporaries Message-ID: <20040413171142.GA28592@globnix.org> Mail-Followup-To: zsh-users@sunsite.dk References: <20040413120053.GA4420@DervishD> <040413082948.ZM20696@candle.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Phil Pennock X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.0 required=6.0 tests=none autolearn=no version=2.63 X-Spam-Hits: 0.0 On 2004-04-13 at 12:40 -0400, 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 > > This is the same as what I get with this: > > print -l $txt That means that you have SH_WORD_SPLIT turned on, which is not a zsh default. If turning sh_word_split off is not an option, then use the '=' parameter expansion modifier twice: print -l $==txt[1,$txt[(i)\[]-2] $==txt[(r)\[,(R)\]] $==txt[$txt[(I)\]]+2,-1] -Phil