Bug#64107: base: 08 mis-parsed as octal?
reassign 64107 bash
thanks
Jim Dennis <jimd@starshine.org> writes:
> Expresssions like:
> echo $[ 08 + 0 ] and echo $(( 08 + 0 ))
>
> Give errors like:
> sh: 08: value too great for base (error token is "08")
>
> Though echo $[ 07 + 2 ] gives the expected result (9).
>
> This is inconsistent with earlier versions of bash as well as
> ksh (using the supported $(( ... )) syntax).
>
>
> Repeat-By:
> echo $[ 08 + 0 ]
>
> Fix:
> Might be a problem in glibc?
No -- it's a bash problem:
<apharris@arroz:boot-floppies> expr 08 + 0
8
<apharris@arroz:boot-floppies> type -all expr
expr is /usr/bin/expr
<apharris@arroz:boot-floppies> echo $[ 08 + 0 ]
bash: 08: value too great for base (error token is "08")
--
.....Adam Di Carlo....adam@onShore.com.....<URL:http://www.onShore.com/>
Reply to: