[Help-bash] Bash is corresponding weird towards invalid array index--Gao
From:
Zhiyuan Gao
Subject:
[Help-bash] Bash is corresponding weird towards invalid array index--Gao 2017.6.2
Date:
Fri, 2 Jun 2017 20:15:15 +0800
Hi there!
When I was playing around with ubuntu 16.04.I tried
$array_1[0]=123
$array_1[1]=456
$array_1[2]=789
And it worked out fine with
$echo ${array_1[0]}
$echo ${array_1[1]}
$echo ${array_1[2]}
What is weird is when I type
$echo
${array_1[99999999999999999999999999999999999999999999999999999999999999999999]}
It actually returned 789!
And the fact is, script with 9s more than
$echo
${array_1[999999999999999999999999999999999999999999999999999999999999999]}
would be returning 789.
Those who end with 8 would be returning 456.
Those who end with 7 would be returning 123.
Is it a bug?
I thought it should be returning bad array script.
Thank you.
Gao Zhiyuan
2017.6.2