I am using a zsh shell and set an environmental array. Like this:
➜ ~ a=(1 2 3 4)
➜ ~ echo $a[3]
3
➜ ~ bash
%n@%m:%~%# b=(1 2 3 4 5)
%n@%m:%~%# echo $b[3]
1[3]
%n@%m:%~%# echo ${b[3]}
4
%n@%m:%~%# exit
exit
➜ ~ echo ${a[3]}
3
➜ ~
Colorful title is zsh while another is bash, they obviously have an opposite result. What I have read from a book about shell is like what the bash acts. So is zsh wrong? And if I write scripts for bash, would it got trouble in zsh environment? I am a newcomer for Linux , thanks if answer.