Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14334 > unrolled thread
| Started by | Robert Elz <kre@munnari.OZ.AU> |
|---|---|
| First post | 2018-07-13 11:35 +0700 |
| Last post | 2018-07-13 11:35 +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: Number with sign is read as octal despite a leading 10# Robert Elz <kre@munnari.OZ.AU> - 2018-07-13 11:35 +0700
| From | Robert Elz <kre@munnari.OZ.AU> |
|---|---|
| Date | 2018-07-13 11:35 +0700 |
| Subject | Re: Number with sign is read as octal despite a leading 10# |
| Message-ID | <mailman.3493.1531456556.1292.bug-bash@gnu.org> |
Date: Tue, 10 Jul 2018 18:46:32 -0400
From: Isaac Marcos <isaacmarcos100010@gmail.com>
Message-ID: <CA+n9pTxfKTmmqPabZ+XMqk4PPhiX4x_yQy-W6TnyndR3iBO-HA@mail.gmail.com>
| set -- 34 034 0034 +34 +034 +0034 -34 -034 -0034 ;
| for i do printf '%6s' "$((10#$i))"; shift; done; echo
You really ought be only using POSIX defined sh operators,
from two more POSIX compatible shells (in this regard...):
jinx$ sh -c 'printf '%6s' "$((10#$i))"'
sh: arithmetic: unexpected '#' (0x23) in expression
jinx$ fbsh !*
fbsh -c 'printf '%6s' "$((10#$i))"'
fbsh: arithmetic expression: expecting EOF: "10#"
Leading "base#" is not part of the sh language at all, and so
should not be expected to work at all, let alone in any particular way.
kre
Back to top | Article view | gnu.bash.bug
csiph-web