From: Nikolai Weibull <now@bitwi.se>
To: Peter Stephenson <Peter.Stephenson@csr.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Avoiding empty element when splitting NUL-separated string from command substitution
Date: Tue, 16 Aug 2011 16:06:01 +0200 [thread overview]
Message-ID: <CADdV=MtQAnhsD1=Ws3H0Y7EK4wmP+75yFZbpLz=afH2bcnCx5A@mail.gmail.com> (raw)
In-Reply-To: <20110816135138.40b27ced@pwslap01u.europe.root.pri>
On Tue, Aug 16, 2011 at 14:51, Peter Stephenson
<Peter.Stephenson@csr.com> wrote:
> On Tue, 16 Aug 2011 14:13:58 +0200
> Nikolai Weibull <now@bitwi.se> wrote:
>> % b=(${(0)"$(print -n)"})
>> % echo $#b
>> 1
>>
>> How do I avoid b containing an empty element in this case? That is,
>> when the command substitution generated no output.
>>
>> (The $(print -n) is, obviously, just an example. It can be the
>> equivalent of, for example, $(print -n $'a\0\b\0c) as well.)
>
> I think that's a bug. You can work around it by assigning the
> double-quoted expression to an intermediate parameter.
OK, thanks.
next prev parent reply other threads:[~2011-08-16 14:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-16 12:13 Nikolai Weibull
2011-08-16 12:51 ` Peter Stephenson
2011-08-16 14:06 ` Nikolai Weibull [this message]
2011-08-16 14:53 ` Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CADdV=MtQAnhsD1=Ws3H0Y7EK4wmP+75yFZbpLz=afH2bcnCx5A@mail.gmail.com' \
--to=now@bitwi.se \
--cc=Peter.Stephenson@csr.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).