Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: What's the reasoning behind z & s returning nular for empty input?
- X-seq: zsh-users 24413
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- Subject: Re: What's the reasoning behind z & s returning nular for empty input?
- Date: Sat, 9 Nov 2019 09:11:25 +0100
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pwxQLBe0vyq4gpXfV7hQa3mYm/4q0cY5eWKH4xmzIeQ=; b=TTpkLsC0kEax3swJGDjvk6XnN6SJKNOutK++It4MgJlXnFaa1XbO2lay5LZDJAbq73 AobD9QoPdQzHzKiOhvKA9teBjLrPN+uXN4IdBQ5wGLEgZ5dWVOvdfqdHB9pNNoTltrY8 PcJYmjI4HE76/mx/KlKdLTTVU9LzR3F3dVlj/PA+VqfCF1WvymwM0KWjmJUVRXLN1oMI Q6j5tlYpUrh7Gj044mgb1IzqhEg2fhT/1+EDE85FpgFKeYXvdsn0Ev9BvXZUdJE2IX5w tJ8RJJTIE/xsLFcXZpp2EpvoEwPSnbTj73o6xv4m1gkQD2VwhJ3atVqsrIcBMShfE9gH nZng==
- In-reply-to: <CAN=4vMpj91iZzOgLNNcUzb4UuTDEAiFxkjyuAa76hqqaQjnFBg@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVCD7e=vATDBc7px1d4XNYiKu1=2iZP9YaJ5PutgsDTsoQ@mail.gmail.com> <CAN=4vMpj91iZzOgLNNcUzb4UuTDEAiFxkjyuAa76hqqaQjnFBg@mail.gmail.com>
On Sat, 9 Nov 2019 at 08:50, Roman Perepelitsa
<roman.perepelitsa@xxxxxxxxx> wrote:
>
> On Sat, Nov 9, 2019 at 8:27 AM Sebastian Gniazdowski
> <sgniazdowski@xxxxxxxxx> wrote:
> >
> > Hi
> > arr=( "${(s:,:):-}" )
> > print -r ${#arr} ${(q)arr}
> > Output: 1 ''
>
> This makes sense. Consider how many elements we should get when
> splitting a string on commas:
>
> split ",,," => 4 elements
> split ",," => 3 elements
> split "," => 2 elements
> split "" => ???
>
> The last split could give either 1 element or 0. The former is
> consistent with the rest, the latter is not.
Thanks for the analysis. The additional problem is that quoted but
@-lacking s-flag should still elide the empty elements, as the manual
states. So this is an intentional exception and I wonder why it has
been added?
--
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org
Messages sorted by:
Reverse Date,
Date,
Thread,
Author