zzh@ZZHPC:~$ zsh ZZHPC% arr=(aaa bbb ccc ddd) ZZHPC% echo ${arr[0]} ZZHPC% echo ${arr[1]} aaa ZZHPC%
# zsh index of array begins from 1.
zzh@ZZHPC:~$ arr=(aaa bbb ccc ddd) zzh@ZZHPC:~$ echo ${arr[0]} aaa
# bash index of array begins from 0.
zzh@ZZHPC:~$ arr=(aaa bbb ccc ddd) zzh@ZZHPC:~$ brr=(${arr[@]:1}) zzh@ZZHPC:~$ crr=(${arr[@]:1:2}) zzh@ZZHPC:~$ drr=(${arr[@]:0:3}) zzh@ZZHPC:~$ echo ${arr[@]} aaa bbb ccc ddd zzh@ZZHPC:~$ echo ${brr[@]} bbb ccc ddd zzh@ZZHPC:~$ echo ${crr[@]} bbb ccc zzh@ZZHPC:~$ echo ${drr[@]} aaa bbb ccc
zzh@ZZHPC:~$ zsh [zzh@(ZZHPC):/home/zzh]$>arr=(aaa bbb ccc ddd) [zzh@(ZZHPC):/home/zzh]$>brr=(${arr[@]:1}) [zzh@(ZZHPC):/home/zzh]$>crr=(${arr[@]:1:2}) [zzh@(ZZHPC):/home/zzh]$>drr=(${arr[@]:0:3}) [zzh@(ZZHPC):/home/zzh]$>echo ${arr[@]} aaa bbb ccc ddd [zzh@(ZZHPC):/home/zzh]$>echo ${brr[@]} bbb ccc ddd [zzh@(ZZHPC):/home/zzh]$>echo ${crr[@]} bbb ccc [zzh@(ZZHPC):/home/zzh]$>echo ${drr[@]} aaa bbb ccc
# The results are the same.
# When slicing, the zsh index of array begins from 0.