Syntax Issue

Hello all. Need a bit of help...

I have :

previous_tmp0=`cat tmp0.txt`
previous_tmp1=`cat tmp1.txt`
previous_tmp2=`cat tmp2.txt`
previous_tmp3=`cat tmp3.txt`
previous_tmp4=`cat tmp4.txt`
previous_tmp5=`cat tmp5.txt`
previous_tmp6=`cat tmp6.txt`
previous_tmp7=`cat tmp7.txt`

Now I want to use the following :

for i in 0 1 2 3 4 5
do
echo "$previous_tmp$i"
if [ ${ARRAY_MOUNT_POINT_CAPACITY[$i]} -eq $previous_tmp$i]
then
    echo "File Size Same of ${ARRAY_MOUNT_POINT_NAME[$i]}"
elif [ ${ARRAY_MOUNT_POINT_CAPACITY[$i]} -gt $previous_tmp$i ]
then
   echo "Mount Point Increase"
else
   echo "Mount Point Decrease"
fi
done

In the line : if [ ${ARRAY_MOUNT_POINT_CAPACITY[$i]} -eq $previous_tmp$i]

, how do I write the statement $previous_tmp$i so that if cals the proper variables ?

For testing script, need to define arrays: ARRAY_MOUNT_POINT_CAPACITY, ARRAY_MOUNT_POINT_NAME

in line 4: include a space before closing square bracket.

define value for $previous_tmp$i as new variable.

Why dont you say you have an error and display the message you got?

I have already defined them . The issue that I am facing right now is how to call the variable within another variable .

$previous_tmp$i

$i is one variables that is being called within $previous_tmp$i.
when the value of i =0,
it should be
$previous_tmp1
which then calls the value stored in $previous_tmp1 that is 23 that i got using

previous_tmp1=`cat tmp1.txt`....

Without that missing space, you wont be going far...
If i is a vatirable "within a variable" it can only be the same.. if i=0 it cannot be i=1 unless you affect a new value... or its another variable... so create another one...

example of defining var:

previous1=aaa
x=1
var=`set | grep "^previous$x="`
var=${var#*=}
echo $var
aaa