[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Arithmetic expansion peculiarity
From: |
Davide Brini |
Subject: |
Re: Arithmetic expansion peculiarity |
Date: |
Fri, 14 Jan 2011 09:30:39 +0000 |
User-agent: |
KMail/1.13.5 (Linux/2.6.36-gentoo-r5; KDE/4.4.5; x86_64; ; ) |
On Thursday 13 Jan 2011 21:11:07 Joe Lightning wrote:
> Description:
> Bash doesn't like leading zeros in arithmetic expansion.
>
> Repeat-By:
> echo $(( 09 - 1 ))
It's all documented. Numbers with leading zeros are treated as octal. In your
case, you can work around that by either removing the leading zeros, or
explicitly telling bash that the number is in base 10:
$ echo $(( 10#09 - 1 ))
8
--
D.