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


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

Re: bug in arithmetic expansion

Started byDavide Brini <dave_br@gmx.com>
First post2019-11-09 16:39 +0100
Last post2019-11-09 16:39 +0100
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: bug in arithmetic expansion Davide Brini <dave_br@gmx.com> - 2019-11-09 16:39 +0100

#15585 — Re: bug in arithmetic expansion

FromDavide Brini <dave_br@gmx.com>
Date2019-11-09 16:39 +0100
SubjectRe: bug in arithmetic expansion
Message-ID<mailman.1117.1573314001.13325.bug-bash@gnu.org>
On Sat, 9 Nov 2019 11:52:56 +0100, Joern Knoll <J.Knoll@gsi.de> wrote:

> [tplx99]:/the/knoll > echo $((0123))
> 83
> [tplx99]:/the/knoll > echo $((123))
> 123
> [tplx99]:/the/knoll > echo $((01234))
> 668
> [tplx99]:/the/knoll > echo $((1234))
> 1234

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

--
D.

[toc] | [standalone]


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


csiph-web