bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug in arithmetic expansion


From: Davide Brini
Subject: Re: bug in arithmetic expansion
Date: Sat, 9 Nov 2019 16:39:52 +0100

On Sat, 9 Nov 2019 11:52:56 +0100, Joern Knoll <address@hidden> wrote:

> [tplx99]:/the/knoll > echo $((0123))
> 83
> [tplx99]:/the/knoll > echo $((123))
> 123
> [tplx99]:/the/knoll > echo $((01234))
> 668
> [tplx99]:/the/knoll > echo $((1234))
> 1234

If you want to force base 10 interpretation (remember that leading 0 mean
octal in arithmetic context), you need to explicitly tell bash:

$ echo $(( 10#0123 ))
123

--
D.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]