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


Groups > gnu.bash.bug > #15588

Re: bug in arithmetic expansion

Path csiph.com!goblin2!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From Robert Elz <kre@munnari.OZ.AU>
Newsgroups gnu.bash.bug
Subject Re: bug in arithmetic expansion
Date Sun, 10 Nov 2019 00:14:10 +0700
Lines 19
Approved bug-bash@gnu.org
Message-ID <mailman.1124.1573319700.13325.bug-bash@gnu.org> (permalink)
References <1MI5UD-1ifIp305PL-00FFhG@mail.gmx.com> <5415801f-6c6e-9664-7747-9adc02a592f8@gsi.de> <27430.1573319650@jinx.noi.kre.to>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Trace usenet.stanford.edu 1573319701 30157 209.51.188.17 (9 Nov 2019 17:15:01 GMT)
X-Complaints-To action@cs.stanford.edu
Cc bug-bash@gnu.org
To Davide Brini <dave_br@gmx.com>
Envelope-to bug-bash@gnu.org
In-Reply-To <1MI5UD-1ifIp305PL-00FFhG@mail.gmx.com>
X-detected-operating-system by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy]
X-Received-From 202.29.151.3
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
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 <https://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>
X-Mailman-Original-Message-ID <27430.1573319650@jinx.noi.kre.to>
X-Mailman-Original-References <1MI5UD-1ifIp305PL-00FFhG@mail.gmx.com> <5415801f-6c6e-9664-7747-9adc02a592f8@gsi.de>
Xref csiph.com gnu.bash.bug:15588

Show key headers only | View raw


    Date:        Sat, 9 Nov 2019 16:39:52 +0100
    From:        Davide Brini <dave_br@gmx.com>
    Message-ID:  <1MI5UD-1ifIp305PL-00FFhG@mail.gmx.com>

  | If you want to force base 10 interpretation (remember that leading 0 mean
  | octal in arithmetic context), you need to explicitly tell bash:
  |
  | $ echo $(( 10#0123 ))
  | 123

But do remember that that form is not portable, and is difficult to
use correctly in the cases that matter (when the actyal number comes
from a variable .. when it is literal, as in all the examples in this
thread, simply omitting the leading 0 is much simpler, and fully portable).

kre


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


Thread

Re: bug in arithmetic expansion Robert Elz <kre@munnari.OZ.AU> - 2019-11-10 00:14 +0700

csiph-web