I have read about specifying "10#", but I don't think it's my case as I am not doing number comparison. I am trying to create an associative array in Bash, and the code worked fine until today (2021-02-08):
dailyData["$today"]="$todayData"
$today is a day in ISO format, $todayData is not relevant.
I am getting the error 2021-02-08: value too great for base (error token is "08")
.
Why does Bash interpret this date format as a number, where an arbitrary string does the job (associative array key)?
What if I wanted to use just "08" as dictionary key?
Best Answer
It's because
dailyData
is being automatically created as indexed array rather than an associative array. Fromman bash
:The issue goes away if you explicitly declare
dailyData
as an associative array: