From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9211 invoked from network); 12 Jan 2006 13:24:14 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) 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.0 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 12 Jan 2006 13:24:14 -0000 Received: (qmail 23563 invoked from network); 12 Jan 2006 13:24:06 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 12 Jan 2006 13:24:06 -0000 Received: (qmail 5263 invoked by alias); 12 Jan 2006 13:23:59 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9831 Received: (qmail 5253 invoked from network); 12 Jan 2006 13:23:58 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 12 Jan 2006 13:23:58 -0000 Received: (qmail 22427 invoked from network); 12 Jan 2006 13:23:58 -0000 Received: from cluster-c.mailcontrol.com (HELO rly11c.srv.mailcontrol.com) (168.143.177.190) by a.mx.sunsite.dk with SMTP; 12 Jan 2006 13:23:55 -0000 Received: from exchange03.csr.com (uuk202166.uk.customer.alter.net [62.189.241.194] (may be forged)) by rly11c.srv.mailcontrol.com (MailControl) with ESMTP id k0CDNA6i014691 for ; Thu, 12 Jan 2006 13:23:49 GMT Received: from csr.com ([10.103.143.38]) by exchange03.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Thu, 12 Jan 2006 13:10:39 +0000 To: zsh-users@sunsite.dk (Zsh users list) Subject: Re: joining array elements In-reply-to: References: <36947C4E-7C19-4BB5-A43B-EC8D3EF0713A@jota.gsc.riken.go.jp> <1060112014126.ZM717@candle.brasslantern.com> <6DC50D24-618F-4531-BA06-0F31570283C1@jota.gsc.riken.go.jp> <0852320A-7790-45A1-9BE5-8B7AB27BD107@jota.gsc.riken.go.jp> Date: Thu, 12 Jan 2006 13:10:39 +0000 From: Peter Stephenson Message-ID: X-OriginalArrivalTime: 12 Jan 2006 13:10:39.0833 (UTC) FILETIME=[95CC8C90:01C61779] Content-Type: text/plain MIME-Version: 1.0 X-Scanned-By: MailControl A-05-40-01 (www.mailcontrol.com) on 10.67.0.121 Wataru Kagawa wrote: > I think my example was unclear (Sorry). Basically, I wanted an > output that looks like, > > David > Matt > Bob[return]Sara[return]Tim > > I can get it with, > foo=$( printf '%s\n' David Matt ${(j:[return]:)usernames} ) > with the 'globsubst' option turned off. However, I was trying to > incorporate your tip, because I wanted to keep that option turned on. > > foo=$( printf '%s\n' David Matt ${(j:[return]:)~~usernames} ) > gives me no output (with the 'nullglob' option set). Are you sure that it's not the nullglob option being applied to the expansion of $foo? Try print -r "$foo" You can also do usernames=(Bob Sara Tim) usernames2=(David Matt ${(j.[return].)~~usernames}) foo=${(F)~~usernames2} Come to think of it, simply quoting the values is a bit neater than the the ~~ flag: usernames=(Bob Sara Tim) usernames2=(David Matt "${(j.[return].)usernames}") foo="${(F)usernames2}" -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 Your mail client is unable to display the latest news from CSR. To access our news copy this link into a web browser: http://www.csr.com/email_sig.html