Chet Ramey (<chet.ra...@case.edu>) wrote:

> On 12/23/18 12:01 PM, Bize Ma wrote:
>
{…}

> > Both command line above should have printed "hello".
>
> No. 0 is the only valid subscript for a non-array variable. The difference
> between bash and other shells that implement this feature is that bash
> warns about negative subscripts.
>

If you say so: fine for me.

It still irks me a little that a `${var[-1]}` isn't the "last value"
(sometimes!, consistency?).

I haven't seen that documented anywhere, though.

Reply via email to