From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20632 invoked by alias); 29 Apr 2012 18:42:11 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17046 Received: (qmail 26347 invoked from network); 29 Apr 2012 18:41:59 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 Received-SPF: neutral (ns1.primenet.com.au: 209.85.212.171 is neither permitted nor denied by SPF record at ntlworld.com) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-proxyuser-ip:date:from:to:subject:message-id:in-reply-to :references:x-mailer:mime-version:content-type :content-transfer-encoding:x-gm-message-state; bh=CNTS4CVpEIOPcsRQBEyvSFSOLo9dLwIqVc4pXvGKi9M=; b=DNB1CQAXlkgW3KH4nKwjHuvdplDtwhvB8MtnveQahJ0lSsh7LPz0gcnRdSKWtFQHxt DyVfWWL0i3GfkdIaG1NS5UmV1rbDuapHgmvJWtkPoG0ayD2+2L8RDjhvIbm81inKmUBI GIumxMtnys/BuFVJYFOR+OHRTVWtpwIHdMuR2e4kbOi3+pPLOmhaDEMpkvzVIwfnqUsk UjOrjiXSbfSWCDqLT2hNiyMlBZLSFYvYvLQkR8SgXo8fGdQ1VKcWlFUXmlvGY7e6ILMa HXo1l/qXWaakNQCzJ/iC3pEli1pR26/UZ8xWX2tEMMGvStmNLtIdORINOQh7kUg10aaZ cYsg== X-ProxyUser-IP: 86.6.29.42 Date: Sun, 29 Apr 2012 19:41:50 +0100 From: Peter Stephenson To: zsh-users@zsh.org Subject: Re: ${(s::)VAR} vs "${(s::)VAR}" Message-ID: <20120429194150.56ad549a@pws-pc.ntlworld.com> In-Reply-To: <120427195048.ZM10479@torch.brasslantern.com> References: <20120427213837.1b861851@pws-pc.ntlworld.com> <120427195048.ZM10479@torch.brasslantern.com> X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.7; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQlpuOtmsBoJKSxvD0epO/Rh+4HhhCKcDDGLJDbAfPb466T3pOXPLdSj/BedMGPYBrsAHqs6 Aha, I have however worked out what's wrong with what I did: % foo=":bar:" % print -l "${(s.:.)foo}" foo % There should be an extra empty element, as there used to be. So I think I need the following instead... Possibly this explains why mul was relegated to the end in that why. Index: Src/utils.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/utils.c,v retrieving revision 1.268 diff -p -u -r1.268 utils.c --- Src/utils.c 16 Apr 2012 11:26:10 -0000 1.268 +++ Src/utils.c 29 Apr 2012 18:39:39 -0000 @@ -3114,7 +3114,7 @@ wordcount(char *s, char *sep, int mul) r = 1; sl = strlen(sep); for (; (c = findsep(&s, sep, 0)) >= 0; s += sl) - if ((c && *(s + sl)) || mul) + if ((c || mul) && (sl || *(s + sl))) r++; } else { char *t = s; Index: Test/D04parameter.ztst =================================================================== RCS file: /cvsroot/zsh/zsh/Test/D04parameter.ztst,v retrieving revision 1.67 diff -p -u -r1.67 D04parameter.ztst --- Test/D04parameter.ztst 22 Apr 2012 18:39:53 -0000 1.67 +++ Test/D04parameter.ztst 29 Apr 2012 18:39:39 -0000 @@ -1292,7 +1292,7 @@ >in >it - foo="line:with::missing::fields:in:it" + foo="line:with::missing::fields:in:it:" print -l "${(@s.:.)foo}" 0:Retention of empty fields in quoted splitting with "@" >line @@ -1303,6 +1303,20 @@ >fields >in >it +> + + str=abcd + print -l ${(s..)str} + print -l "${(s..)str}" +0:splitting of strings into characters +>a +>b +>c +>d +>a +>b +>c +>d array=('%' '$' 'j' '*' '$foo') print ${array[(i)*]} "${array[(i)*]}" -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/