[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Strange bug in arithmetic function
From: |
Chris Jones |
Subject: |
Re: Strange bug in arithmetic function |
Date: |
Tue, 22 Feb 2011 10:02:16 -0500 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
On Mon, Feb 21, 2011 at 04:13:54AM EST, Marcel de Reuver wrote:
> In a bash script I use: $[`date --date='this week' +'%V'`%2] to see if
> the week number is even.
> Only in week 08 the error is: bash: 08: value too great for base
> (error token is "08") the same in week 09, all others are ok...
Due to the prepended zero, bash thinks you are using octal (base 8)
numbers.
Compare:
$ a=$((7+8))
$ echo $a
15
$ a=$((7+08))
$ bash: 08: value too great for base (error token is "08")
cj