From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7883 invoked from network); 10 Dec 2008 07:01:12 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 10 Dec 2008 07:01:12 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 80979 invoked from network); 10 Dec 2008 07:00:56 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 10 Dec 2008 07:00:55 -0000 Received: (qmail 24466 invoked by alias); 10 Dec 2008 07:00:39 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 13565 Received: (qmail 24448 invoked from network); 10 Dec 2008 07:00:38 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 10 Dec 2008 07:00:38 -0000 Received: from mail.o2.co.uk (sidious.london.02.net [82.132.130.152]) by bifrost.dotsrc.org (Postfix) with ESMTP id 9315B80525CB for ; Wed, 10 Dec 2008 08:00:33 +0100 (CET) Received: from sc.homeunix.net (78.105.235.196) by mail.o2.co.uk (8.0.013.3) (authenticated as stephane.chazelas) id 4938FA4500F388EF; Wed, 10 Dec 2008 07:00:32 +0000 Received: from chazelas by sc.homeunix.net with local (Exim 4.69) (envelope-from ) id 1LAJ3e-0001K5-4v; Wed, 10 Dec 2008 07:00:30 +0000 Date: Wed, 10 Dec 2008 07:00:30 +0000 From: Stephane Chazelas To: Webb Sprague Cc: zsh-users@sunsite.dk Subject: Re: "joining" an array with tabs (default is space) Message-ID: <20081210070030.GA4843@sc.homeunix.net> Mail-Followup-To: Webb Sprague , zsh-users@sunsite.dk References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.16 (2007-09-19) X-Virus-Scanned: ClamAV 0.92.1/8740/Wed Dec 10 03:10:20 2008 on bifrost X-Virus-Status: Clean On Tue, Dec 09, 2008 at 11:27:38AM -0800, Webb Sprague wrote: > Hi all, > > If I set IFS='\t', it works great with read -A LINE. However I want > to join the output using '\t' instead of spaces-- is there a simple > way to do that? I can write a for loop, or maybe recycle print -f > "\t%s", or maybe use columns in the print, but I was hoping for a > super graceful (ie typical zsh) approach. [...] Try IFS=$'\t' Then "${var[*]}" will be joined with spaces. It's the same in every Bourne-like shell but the Bourne shell (and earlier Almquist shells) $ IFS=$'\t' $ set a b $ echo "$*" | cat -t a^Ib $ a=(a b) $ echo "${a[*]}" | cat -t a^Ib Actually, with zsh (and zsh only) $array is the same as ${array[*]}, so: $ echo "$a" | cat -t a^Ib -- Stéphane