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?



On Sat, Nov 9, 2019 at 9:40 AM Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
>
> On Sat, 9 Nov 2019 at 09:22, Roman Perepelitsa
> <roman.perepelitsa@xxxxxxxxx> wrote:
> >
> > On Sat, Nov 9, 2019 at 9:11 AM Sebastian Gniazdowski
> > <sgniazdowski@xxxxxxxxx> wrote:
> > > 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?
> >
> > Here's the passage from zshexpn:
>
> Yes, I was also referring to this fragment, however it states that the
> empty elements should be removed, and even – that they should be
> removed more eagerly, so I still wonder why produce a nular for an
> empty input?

Oh, I see what you mean. Apparently, only inner empty elements are
dropped by "${(s...)...}" while the first and the last are retained.

    "${(s:,:):-a,,b}" => (a b)
    "${(s:,:):-,,}" => ('' '')

Looks like it's either a bug in the code or in the documentation.

Roman.



Messages sorted by: Reverse Date, Date, Thread, Author