From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27955 invoked from network); 4 Oct 2006 20:18:46 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.5 (2006-08-29) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,FORGED_RCVD_HELO autolearn=ham version=3.1.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 4 Oct 2006 20:18:46 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 27261 invoked from network); 4 Oct 2006 20:18:40 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 4 Oct 2006 20:18:40 -0000 Received: (qmail 2429 invoked by alias); 4 Oct 2006 20:18:31 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10784 Received: (qmail 2419 invoked from network); 4 Oct 2006 20:18:30 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 4 Oct 2006 20:18:30 -0000 Received: (qmail 25967 invoked from network); 4 Oct 2006 20:18:30 -0000 Received: from lucien.blight.com (204.10.50.50) by a.mx.sunsite.dk with SMTP; 4 Oct 2006 20:18:29 -0000 Received: from lucien.blight.com (localhost [127.0.0.1]) by lucien.blight.com (0.0.0/0.0.0) with ESMTP id k94KIOEJ007126; Wed, 4 Oct 2006 15:18:24 -0500 Received: (from larold@localhost) by lucien.blight.com (0.0.0/0.0.0) id k94KIOoh007124; Wed, 4 Oct 2006 15:18:24 -0500 Date: Wed, 4 Oct 2006 15:18:24 -0500 From: "Larry P. Schrof" To: Dan Nelson Cc: zsh-users@sunsite.dk Subject: Re: Question on array processing. Message-ID: <20061004201824.GA5956@lucien.blight.com> References: <20061004200025.GA3092@lucien.blight.com> <20061004200759.GG54791@dan.emsphone.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20061004200759.GG54791@dan.emsphone.com> User-Agent: Mutt/1.4.2i Awesome - thanks! Huge favor - could the zshparam man page please be updated to reflect this? I didn't see anything about it in the subscript flags section. Also, while I'm requesting updates to the man page, I wanted to point out a couple of typos I found if anybody wants to correct them. On the zshparams man page, under the subscript flags section, there is an identical typo that appears twice: On the first line of both the 'w' and 'f' subscript flags, the text reads: "If the parameter subscripted is a scalar than this flag makes" The 'than' should probably be 'then'. Sorry to be anal. ;) - Larry On Wed, Oct 04, 2006 at 03:07:59PM -0500, Dan Nelson wrote: > In the last episode (Oct 04), Larry P. Schrof said: > > There is a subscript flag, s: , (used with the 'w' flag) that > > allows you to index into a string as if it were an array, using > > as a separator for elements. > > > > Here's my question: > > > > I absolutely can NOT figure out how to get zsh to use a single colon > > (':') as a separator. No matter how I try to quote the second colon, > > zsh sees the second colon in the expression as the termination for > > the separator string. > > > > I'm tring to do something like: > > > > > str="these:are:some:words" > > > echo ${str[(ws:::)2]} > > zsh: bad math expression: operand expected at `::)2' > > > > I've also tried :":":, :\::, and :':': - none of those work. > > > > Is this a small flaw / hole in zsh's functionality? > > You can use any character as a delimiter, not just a colon: > > $ str="these:are:some:words" > $ echo ${str[(ws/:/)2]} > are > > -- > Dan Nelson > dnelson@allantgroup.com