Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Avoiding empty element when splitting NUL-separated string from command substitution



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