First approach
Code:
i=1
while [ $i -le 5 ]
do
eval COUNT$i=$i
(( i+= 1 ))
done
The second approach works fine for me, what is your problem ?
execute with -x option to verify variable creation.
Note: The two solutions works only with
bash and
ksh due to '(( ))' syntax usage.
(( i+= 1)) can be replaced by i=`expr $i + 1`