From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2400 invoked from network); 12 Jan 2006 11:55:17 -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 11:55:17 -0000 Received: (qmail 61851 invoked from network); 12 Jan 2006 11:55:09 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 12 Jan 2006 11:55:09 -0000 Received: (qmail 22374 invoked by alias); 12 Jan 2006 11:55:02 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9828 Received: (qmail 22361 invoked from network); 12 Jan 2006 11:55:01 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 12 Jan 2006 11:55:01 -0000 Received: (qmail 60565 invoked from network); 12 Jan 2006 11:55:01 -0000 Received: from cluster-c.mailcontrol.com (HELO rly14c.srv.mailcontrol.com) (168.143.177.190) by a.mx.sunsite.dk with SMTP; 12 Jan 2006 11:54:59 -0000 Received: from exchange03.csr.com (uuk202166.uk.customer.alter.net [62.189.241.194] (may be forged)) by rly14c.srv.mailcontrol.com (MailControl) with ESMTP id k0CBseS6000837 for ; Thu, 12 Jan 2006 11:54:56 GMT Received: from csr.com ([10.103.143.38]) by exchange03.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Thu, 12 Jan 2006 11:54:49 +0000 To: zsh-users@sunsite.dk (Zsh users list) Subject: Re: joining array elements In-reply-to: <0852320A-7790-45A1-9BE5-8B7AB27BD107@jota.gsc.riken.go.jp> 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 11:54:48 +0000 From: Peter Stephenson Message-ID: X-OriginalArrivalTime: 12 Jan 2006 11:54:49.0142 (UTC) FILETIME=[FD603560:01C6176E] Content-Type: text/plain MIME-Version: 1.0 X-Scanned-By: MailControl A-05-40-01 (www.mailcontrol.com) on 10.67.0.124 Wataru Kagawa wrote: > Hi Peter, > > Thank you for the tip. I would like to place the expansion into a > variable, however, I am having a trouble. > > % usernames=( Bob Sara Tim ) > % print -R ${(j:[return]:)~~usernames} > Bob[return]Sara[return]Tim > > However, > > % foo=$( printf '%s\n' David Matt ${(j:[return]:)~~usernames} ) > % echo $foo What effect are you trying to achieve? The command you show does exactly what I expect it to. Do you mean you want David and Matt added in the same way and the result put in foo? usernames2=(David Matt $usernames) foo=${(j:[return]:)~~usernames2} Or do you mean you want the same effect as you get when outputting David and Matt using printf, but with all the names, so that foo ends up being joined with newlines? 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