From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24279 invoked from network); 13 Apr 2004 17:17:04 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 13 Apr 2004 17:17:04 -0000 Received: (qmail 5925 invoked by alias); 13 Apr 2004 17:16:26 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7344 Received: (qmail 5854 invoked from network); 13 Apr 2004 17:16:25 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 13 Apr 2004 17:16:25 -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:16:25 -0000 Received: (qmail 11909 invoked from network); 13 Apr 2004 17:16:24 -0000 Received: from madrid10.amenworld.com (62.193.203.32) by a.mx.sunsite.dk with SMTP; 13 Apr 2004 17:16:22 -0000 Received: from DervishD.pleyades.net (212.Red-80-35-44.pooles.rima-tde.net [80.35.44.212]) by madrid10.amenworld.com (8.10.2/8.10.2) with ESMTP id i3DHGJh03660; Tue, 13 Apr 2004 19:16:19 +0200 Received: from raul@pleyades.net by DervishD.pleyades.net with local (Exim MTA 2.05) id <1BDRX2-00012Y-00>; Tue, 13 Apr 2004 19:17:08 +0200 Date: Tue, 13 Apr 2004 19:17:08 +0200 From: DervishD To: Lloyd Zusman Cc: zsh-users@sunsite.dk Subject: Re: Subscripting without temporaries Message-ID: <20040413171708.GB3850@DervishD> Mail-Followup-To: Lloyd Zusman , zsh-users@sunsite.dk References: <20040413120053.GA4420@DervishD> <040413082948.ZM20696@candle.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.4.2.1i Organization: Pleyades 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 Hi Lloyd :) * Lloyd Zusman dixit: > > However, as you can treat strings as arrays and index them by character, > > and also do slices with pairs of indices: > > 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 You have shwordsplit set. Unset it. Believe me, is much better that way if you work with arrays, parameters and the like ;) Raúl Núñez de Arenas Coronado -- Linux Registered User 88736 http://www.pleyades.net & http://raul.pleyades.net/