My intention is to retrieve the value of the table dynamically, in the first run of the loop where t=1, value of table should be "table" and should be "other table" in the second run, so i tried to name the variable using for loop, but my output is "1","2" instead of "table","other table".But if I put table=$TABLENAME$1, output is "table". I couldn't pick the error, I am new to shell scripting, excuse if there is any blunder, thank you!!
TABLENAME1="table"
TABLENAME2="other table"
NUM_TABLE=2
for (( t = 1; t <= ${NUM_TABLE}; t++ )){
table=$TABLENAME$t
echo $table
}