[ Site Home | Journal Home ]
I used a date calculation in a script, that failed:
jamespk@hal:~$ let day_of_year=$(date "+%j") bash: let: day_of_year=049: value too great for base (error token is "049")
It turns out bash is treating the number as octal because of the leading zero.
A solution is to specify the base-10 prefixjamespk@hal:~$ let day_of_year=10#$(date "+%j") jamespk@hal:~$ echo $day_of_year 49
posted at: 00:00 | path: /shell | permanent link to this entry