Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14999 > unrolled thread

Re: Error on arithmetic evaluation of `~0`.

Started byBize Ma <binaryzebra@gmail.com>
First post2018-12-29 01:26 -0400
Last post2018-12-29 01:26 -0400
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Error on arithmetic evaluation of `~0`. Bize Ma <binaryzebra@gmail.com> - 2018-12-29 01:26 -0400

#14999 — Re: Error on arithmetic evaluation of `~0`.

FromBize Ma <binaryzebra@gmail.com>
Date2018-12-29 01:26 -0400
SubjectRe: Error on arithmetic evaluation of `~0`.
Message-ID<mailman.6495.1546062259.1284.bug-bash@gnu.org>
Chet Ramey (<chet.ramey@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.

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web