Outside of the code I posted below I defined an array fanrp0[1] and fanrp0[2] I did the same for fans 0 through 3. I'm trying to make fstat change and echo each of the fans in two arrays.
for (( f=1; f<=2; f++ ))
do
for (( f2=0; f2<=3; f2++ ))
do
fstat="${(fanrp$f2)[$f]}"
echo $fstat
done
done
evalsomewhat more easily, as ineval "fstat=\${fanrp$f2[$f]}", but keep in mind that there are some security issues with usingeval. I'd start by reading that Bash FAQ page I linked to.[...]not as indexing syntax, but as part of the name of the variable. If you have an arrayfoo, thenfoo[0],foo[1], etc. are just oddly named variables, each with their own value. Thenx=foo[0]leads naturally to${!x}being equivalent to${foo[0]}.