Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Subscript flag (i) not working correctly on empty strings?
- X-seq: zsh-workers 51288
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Subscript flag (i) not working correctly on empty strings?
- Date: Sun, 08 Jan 2023 19:47:32 +0000
- Archived-at: <https://zsh.org/workers/51288>
- In-reply-to: <CAH+w=7Z5=ncO6JXa=qhbXkXkpC_3V5gBSv4eCv=ASXjYmT1zVA@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAGdYchuqW79Q3nMguaOrJKEcRwMnQgDRNhHmh3hF5V6sgp=q4g@mail.gmail.com> <361494476.8470860.1673025799682@mail.virginmedia.com> <CAH+w=7Z5=ncO6JXa=qhbXkXkpC_3V5gBSv4eCv=ASXjYmT1zVA@mail.gmail.com>
On Fri, 2023-01-06 at 10:12 -0800, Bart Schaefer wrote:
> On Fri, Jan 6, 2023 at 9:24 AM Peter Stephenson
> <p.w.stephenson@xxxxxxxxxxxx> wrote:
> >
> > > On 06/01/2023 16:01 Philippe Altherr <philippe.altherr@xxxxxxxxx> wrote:
> > >
> > > > s=; echo $s[(i)z];
> > > > 0
> > >
> > > Why is the last line 0 and not 1?
> >
> > Certainly looks plain wrong.
> > None of the existing tests fail with this change.
>
> I thought there was a discussion about this at some point in the past
> ... but it may have been limited to array cases. I have the feeling
> we concluded that (i) and (I) should produce the same result on empty
> string for purposes of boolean tests, but I can't find such a
> conversation in the archives.
Can you think of any piece of shell code that might rely on this,
in the absence of any historical corpus? As far as I can see
this is a plain misuse of (i), which isn't there for boolean tests.
This doesn't feel to me like a big issue anyway and in the absence of a
clear cut reason I would think consistency should triumph.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author