From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6993 invoked by alias); 3 Sep 2015 16:21:56 -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: 20504 Received: (qmail 6923 invoked from network); 3 Sep 2015 16:21:55 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=Km0cdpcpQPrwdWsqNcJE8NxfmKGOgG3/mRz5TaDz2o0=; b=d8hIHq3GiUt8x/BrX37FuzwZuCTRjiReRsez5i0ACaK0MJmr+0U05ixzUdp8V+tew0 fLM2tPq/J41Fo84Ee4U/kazEf9Mfcu1dThI9GspGkVas1WqUo5ZfITFxCbPi82h5/Bbt onOfAm6FD7I8YtvS3L5BD2A0i/LfQ+4/jdCZIKF4pi7dlnCwIJjUAUJnzZRaKkWLydtG wIIJmswCbd4rdyd9WjSvCkSUDj1joq31MXICTeP12dwGHrtOPZ/gwYLlMJukZY98YjzQ mbYDSJlLDA1dpqCzBIkCOpwuuMCO5e4kV+a2mj6AASm2pTWtHQAwjGdoom35ltlUpOnL OyGg== X-Received: by 10.194.179.6 with SMTP id dc6mr26654264wjc.39.1441297312241; Thu, 03 Sep 2015 09:21:52 -0700 (PDT) Date: Thu, 3 Sep 2015 17:21:49 +0100 From: Stephane Chazelas To: Ray Andrews Cc: zsh-users@zsh.org Subject: Re: string to array space problem in filenames Message-ID: <20150903162149.GA8174@chaz.gmail.com> Mail-Followup-To: Ray Andrews , zsh-users@zsh.org References: <20150821215037.6b010cf7@ntlworld.com> <55DFC1E6.5090400@eastlink.ca> <55E0AE60.9090706@eastlink.ca> <150828124334.ZM7129@torch.brasslantern.com> <55E7C084.2060505@eastlink.ca> <150902222539.ZM18111@torch.brasslantern.com> <55E86605.7080304@eastlink.ca> <55E86E0C.1000806__15798.3473306105$1441295967$gmane$org@eastlink.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55E86E0C.1000806__15798.3473306105$1441295967$gmane$org@eastlink.ca> User-Agent: Mutt/1.5.21 (2010-09-15) 2015-09-03 08:58:04 -0700, Ray Andrews: > On 09/03/2015 08:30 AM, Mikael Magnusson wrote: > > >-r is good to use as I explained in my other mail, -u2 means to > >print to stderr which would be a very strange thing to do here, > >since it won't go to 'file'. > > I was just typing a post to ask about that ... I'll take that on > faith, however one further question: > > print -rl - "${array[@]}" > file > > ... do I or don't I like the double dash that seems to usually be there? > And a few code specimens have shown no dash(es) at all there, which scares > me since disaster is never far away from the unwary. An annoying thing with print -l (and it's the same with its standard equivalent printf '%s\n') is that you get the same output for an empty list and a list of one empty element. That is: list=() print -rl -- "$list[@]" list=('') print -rl -- "$list[@]" both print one empty line. so, strictly speaking, you need to write it: println() { [ "$#" -eq 0 ] || printf '%s\n' "$@" } println "$list[@]" -- Stephane