Path: csiph.com!3.us.feeder.erje.net!feeder.erje.net!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: Robert Elz Newsgroups: gnu.bash.bug Subject: Re: Number with sign is read as octal despite a leading 10# Date: Fri, 13 Jul 2018 11:35:00 +0700 Lines: 23 Approved: bug-bash@gnu.org Message-ID: References: <71850c03-54d3-6a7e-1d29-136950d9e139@iki.fi> <471822f3-4484-59b5-0433-fc394dc9b34a@case.edu> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: usenet.stanford.edu 1531456556 21785 208.118.235.17 (13 Jul 2018 04:35:56 GMT) X-Complaints-To: action@cs.stanford.edu Cc: Eduardo Bustamante , bug-bash , bash@packages.debian.org, Chet Ramey To: Isaac Marcos Envelope-to: bug-bash@gnu.org In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:3c8:9009:181::2 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:14334 Date: Tue, 10 Jul 2018 18:46:32 -0400 From: Isaac Marcos Message-ID: | 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