Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15584 > unrolled thread
| Started by | pepa65 <solusos@passchier.net> |
|---|---|
| First post | 2019-11-09 22:12 +0700 |
| Last post | 2019-11-09 22:12 +0700 |
| 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.
Re: bug in arithmetic expansion pepa65 <solusos@passchier.net> - 2019-11-09 22:12 +0700
| From | pepa65 <solusos@passchier.net> |
|---|---|
| Date | 2019-11-09 22:12 +0700 |
| Subject | Re: bug in arithmetic expansion |
| Message-ID | <mailman.1112.1573312389.13325.bug-bash@gnu.org> |
In the arithmetic context, leading zeroes signify an octal base. Had you used an 8 or 9, you would have gotten a message like: bash: 08: value too great for base (error token is "08") when trying: echo $((08)) So it's not a bug, it's a feature; make sure your base-10 numbers don't have leading zeroes! Peter On 11/9/19 5:52 PM, Joern Knoll wrote: > Hallo, > > in playing around with digital keys (integers) which have a simple > arithmetic check property, I encountered problemsusing bash's arithmetic > expansion, when ever the used digital substrings have leading zeros. The > problem shows up already for the simplest operations, namely converting > a string argument to its numerical value, as shown below. > > With thanks for your attention and best regards, Jörn Knoll > > [tplx99]:/the/knoll > echo $((0123)) > 83 > [tplx99]:/the/knoll > echo $((123)) > 123 > [tplx99]:/the/knoll > echo $((01234)) > 668 > [tplx99]:/the/knoll > echo $((1234)) > 1234 > >
Back to top | Article view | gnu.bash.bug
csiph-web