Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Avoiding empty element when splitting NUL-separated string from command substitution
- X-seq: zsh-users 16254
- From: Nikolai Weibull <now@xxxxxxxx>
- To: Peter Stephenson <Peter.Stephenson@xxxxxxx>
- Subject: Re: Avoiding empty element when splitting NUL-separated string from command substitution
- Date: Tue, 16 Aug 2011 16:06:01 +0200
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=EKQCQDNfnOUkkheDFFVnlghehnNXd/9wfOoTFYaNc0c=; b=ifqyI2ya1hJYKR0sWGCXczGgdz9dK4zongfXiLjjk5XRnWB8rF4VRcFi5lTh8oiyWw xC2i/u5R4ga5WrLjaAKGJQ45zHmZLWRvOhk6gs0hUUy8ZxwsT9tPID5L1XEjzQoH04// 9TJAEQ1yn4INIyV8U6WovPNKQwSVUqkoyr1ec=
- In-reply-to: <20110816135138.40b27ced@pwslap01u.europe.root.pri>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CADdV=Mt4_iSEqxK4uCQTgD=3OoshuXOZcdUPRZgwZJy2jjbCbQ@mail.gmail.com> <20110816135138.40b27ced@pwslap01u.europe.root.pri>
- Sender: nikolai.weibull@xxxxxxxxx
On Tue, Aug 16, 2011 at 14:51, Peter Stephenson
<Peter.Stephenson@xxxxxxx> wrote:
> On Tue, 16 Aug 2011 14:13:58 +0200
> Nikolai Weibull <now@xxxxxxxx> 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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author