I am trying to write a piece of code that will call a value from an array. There are multiple arrays that I need to call data from. Only one array needs to be used based on the step within the program. The arrays have the names "cue_0", "cue_1", and so on.
I can't figure out how to call a value from an array based on the array number (the one after the underscore) and the position within the array. I have been able to get it working when not using a variable in the array name, but putting a variable within the array name makes it stop working. I get an error that says "bad substitution" about the line of code noted below when I replace the "0" with a variable.
The code below is the part of my script that I am having trouble with. Any help would be greatly appreciated.
for i in `seq 0 23`; do
let position=i*4+9
tput cup 1 $position
case ${cue_0[$i]} in # I want to replace the "0" in this line with a variable"
0) printf "off" ;;
1) printf "on" ;;
esac
done