Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14316
| From | Greg Wooledge <wooledg@eeg.ccf.org> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: Number with sign is read as octal despite a leading 10# |
| Date | 2018-07-10 11:04 -0400 |
| Message-ID | <mailman.3379.1531235084.1292.bug-bash@gnu.org> (permalink) |
| References | <CA+n9pTy7vSPUA0j-bDF9_eWF0XysePRDAFckgvvHX8haSWv7KQ@mail.gmail.com> <5fda6745-9bea-b881-76f0-21f2488df229@case.edu> |
On Tue, Jul 10, 2018 at 11:00:36AM -0400, Chet Ramey wrote: > On 7/9/18 9:24 PM, Isaac Marcos wrote: > > > Bash Version: 4.4 > > Patch Level: 12 > > Release Status: release > > > > Description: > > A value inside an arithmetic expansion is processed as octal despite using > > a 10# preffix. > > An integer constant cannot contain a `+'. > > > > > Repeat-By: > > $ echo $((10#+0034)) > > 28 > > If anything, this is bash being too liberal in accepting constants that > begin with `base#'. There would be a good case for rejecting the `10#' > because it's missing the value. It also happens with negative values. I wish the original poster had shown that case as well. wooledg:~$ n=-019; echo "$((10#$n))" bash-5.0: 10#-019: value too great for base (error token is "019")
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Re: Number with sign is read as octal despite a leading 10# Greg Wooledge <wooledg@eeg.ccf.org> - 2018-07-10 11:04 -0400
csiph-web