From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25817 invoked from network); 4 Oct 2006 20:08:41 -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=AWL,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:08:41 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 150 invoked from network); 4 Oct 2006 20:08:33 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 4 Oct 2006 20:08:33 -0000 Received: (qmail 26404 invoked by alias); 4 Oct 2006 20:08:24 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10782 Received: (qmail 26395 invoked from network); 4 Oct 2006 20:08:23 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 4 Oct 2006 20:08:23 -0000 Received: (qmail 98912 invoked from network); 4 Oct 2006 20:08:23 -0000 Received: from dan.emsphone.com (199.67.51.101) by a.mx.sunsite.dk with SMTP; 4 Oct 2006 20:08:22 -0000 Received: (from dan@localhost) by dan.emsphone.com (8.13.6/8.13.6) id k94K7xST026328; Wed, 4 Oct 2006 15:07:59 -0500 (CDT) (envelope-from dan) Date: Wed, 4 Oct 2006 15:07:59 -0500 From: Dan Nelson To: "Larry P. Schrof" Cc: zsh-users@sunsite.dk Subject: Re: Question on array processing. Message-ID: <20061004200759.GG54791@dan.emsphone.com> References: <20061004200025.GA3092@lucien.blight.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20061004200025.GA3092@lucien.blight.com> X-OS: FreeBSD 6.1-STABLE X-message-flag: Outlook Error User-Agent: Mutt/1.5.13 (2006-08-11) 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