I am working in Bash shell, Linux OS. I have the following for loop:
for ((i=0;i<${#listModels[@]};i++))
do
var=${listVersion[$i]}
if [ ${!var} ]
then
export MY_LIBRARY_PATH=$MY_LIBRARY_PATH:$ROOT_PATH/${listModels[$i]}/${listModels[$i]}_${!var}
else
echo ">>>> No ${listModels[$i]} version! <<<<"
fi
done
Before this, I have the following in the script:
listModels=(model1
model2
model3)
listVersion=(MODEL1
MODEL2
MODEL3)
The concept is MODEL1,MODEL2 and MODEL3 keep changing every now and then, for eg it becomes MODEL1.1,MODEL2.2,.. And I expect the script to modify my path everytime the listVersion values change. But could anybody explain how exactly the for loop functions (especially [@] and [$i] stuff). I am new to Bash and I know only the basic commands. Thanks in advance!