Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Bize Ma 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: References: <25e8adf0-96d5-1e38-faea-e7620ba3f846@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 To: Chester Ramey 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: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:14999 Chet Ramey () wrote: > On 12/23/18 12:01 PM, Bize Ma wrote: > {=E2=80=A6} > > Both command line above should have printed "hello". > > No. 0 is the only valid subscript for a non-array variable. The differenc= e > 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.