Check out example codes for "bash access array indirectly". It will help you in understanding the concepts better.

Code Example 1

#!/usr/bin/env bash

ARRAYNAME='FRUITS'
FRUITS=( APPLE BANANA ORANGE )

eval array=\( \${${ARRAYNAME}[@]} \)

for fruit in "${array[@]}"; do
  echo ${fruit}
done

Learn ReactJs, React Native from akashmittal.com