[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Number with sign is read as octal despite a leading 10#
From: |
Robert Elz |
Subject: |
Re: Number with sign is read as octal despite a leading 10# |
Date: |
Fri, 13 Jul 2018 11:35:00 +0700 |
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
- Re: Number with sign is read as octal despite a leading 10#, (continued)
- Re: Number with sign is read as octal despite a leading 10#, Clint Hepner, 2018/07/09
- Re: Number with sign is read as octal despite a leading 10#, Ilkka Virta, 2018/07/10
- Re: Number with sign is read as octal despite a leading 10#, Ilkka Virta, 2018/07/10
- Re: Number with sign is read as octal despite a leading 10#, Chet Ramey, 2018/07/10
- Re: Number with sign is read as octal despite a leading 10#, Ilkka Virta, 2018/07/10
- Message not available
- Message not available
- Re: Number with sign is read as octal despite a leading 10#, Isaac Marcos, 2018/07/10
- Re: Number with sign is read as octal despite a leading 10#, Eduardo Bustamante, 2018/07/10
- Re: Number with sign is read as octal despite a leading 10#, Isaac Marcos, 2018/07/10
- Re: Number with sign is read as octal despite a leading 10#, Isaac Marcos, 2018/07/10
- Re: Number with sign is read as octal despite a leading 10#, Chet Ramey, 2018/07/10
- Re: Number with sign is read as octal despite a leading 10#,
Robert Elz <=
- Re: Number with sign is read as octal despite a leading 10#, Chet Ramey, 2018/07/10
- Re: Number with sign is read as octal despite a leading 10#, Pierre Gaston, 2018/07/10
Re: Number with sign is read as octal despite a leading 10#, Chet Ramey, 2018/07/10