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


Groups > gnu.bash.bug > #14999

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

Path csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From Bize Ma <binaryzebra@gmail.com>
Newsgroups gnu.bash.bug
Subject Re: Error on arithmetic evaluation of `~0`.
Date Sat, 29 Dec 2018 01:26:33 -0400
Lines 20
Approved bug-bash@gnu.org
Message-ID <mailman.6495.1546062259.1284.bug-bash@gnu.org> (permalink)
References <CAFra36gW8Csu-84oRLV7QsR7PbiMYq6g7WnMktjfnrSdTys38g@mail.gmail.com> <25e8adf0-96d5-1e38-faea-e7620ba3f846@case.edu> <CAFra36gzzbJLjqt9OYtJUuJara3KR2+ew-Gj3y2mA2L4X8CRyw@mail.gmail.com> <fc279c3d-35f8-1afa-e515-bfcf2f3bed44@case.edu>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding quoted-printable
X-Trace usenet.stanford.edu 1546062259 4746 208.118.235.17 (29 Dec 2018 05:44:19 GMT)
X-Complaints-To action@cs.stanford.edu
Cc bug-bash <bug-bash@gnu.org>
To Chester Ramey <chet.ramey@case.edu>
Envelope-to bug-bash@gnu.org
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=U43zmiHAkn1wKmhf7k1DGfro+6jCxMloYlgQb5WK4XQ=; b=luGrFXvUrofza22vl3a9Q3exwSoY5SbSpHrUpOdg/LUibOCv3bcEgKJbMJMBuSRSWT xUewS0O7gdIAmfMwyjlRv8i+43Vq5VH1jl//nNpoBxYZoO0BcPbzqzBut1RCIrpIXxWp kD5cKMOWDgK2DBDpXXiOAz3C4pwNn3f5aWMfjzvZUplX47xsok7X4HXWUJThTuIw/qxY LWWKBR6HBLthVg2Y1MTCowCVYYXOXwFvrZsrrGOR83X3izWt0YVzwbYfD0bPyRt7dZdu CHSJsU1/K7nKE7dsLOL+2qOzNUwZPY19wUUcipF5Mr4/ASiWUoi2m/EhzBefB32jQoN3 i4tg==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=U43zmiHAkn1wKmhf7k1DGfro+6jCxMloYlgQb5WK4XQ=; b=NDpa6TetITlIkGtffaFfwCgmEybqpNfkFwgOaqNkyiBuGW6Dxxu+l+aIM1rOkFGP/s CRKyiOk5ZPZbljMZdS71/Nj3SSpgXYqJXO2ZeJjrDOuvEeeJUkXYrSpWY1wDv/AKy3GJ /fhAyRTFNJRB9yEMEfn3jjG0oGM5m+zrkzmZwhPuVAfzJ9QuwRrALtsMHQFV4+Yuw+rE 34lmkaw6KQX0S+eeYiLwvg4yDrfqZuyXukhH4IaDG4/5ajkCSU93YY3j7mKvDEOp7CqX /2P4lKFGTRZ7leVIRnz46DT0h3SEzb9O25UIlsLv548uiu8yuFzMNJ81jfl1kdf27Teo ahxw==
X-Gm-Message-State AJcUukeQH37N6yrqjWkUFHRZlJGH7Xw3AlpU7NWWL33UKDlUh1O4rPaZ nLdb4OgqHfIeLk3JC4p14RSLji0UFHgZVGVLiFI=
X-Google-Smtp-Source ALg8bN5cOvlY/fdn2VobKKhlMIkJGpL9CB7OkvgAyzwgcgVPnCfYz9ARw65humApVGLb0CtY/Id239/fDp3NBRmtDqU=
X-Received by 2002:a9d:348:: with SMTP id 66mr19305812otv.300.1546061206759; Fri, 28 Dec 2018 21:26:46 -0800 (PST)
In-Reply-To <fc279c3d-35f8-1afa-e515-bfcf2f3bed44@case.edu>
X-detected-operating-system by eggs.gnu.org: Genre and OS details not recognized.
X-Received-From 2607:f8b0:4864:20::333
X-Content-Filtered-By Mailman/MimeDel 2.1.21
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.21
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash/>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:14999

Show key headers only | View raw


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.

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web