Using backspace in echo to show process count

i have something like this

 
tablesName="abc def hij akn ... etc etc"
count=0
for i in $tablesName
do
         echo -en "\b\b\b\b\b\b\b\b\b\b\b\b\bTableCount: $count"
         count=`expr $count + 1`
 
done

the above is just a description wha i need is when the loop executes
the output should display
in first cycle TableCount: 1
then in second cycle the above line should be erased and in same place instead of 1 it should display 2.... there shouldnt be any next line characters... all this should be done in same line in output window.
any help id deeply appreciated...

Try:

count=0
for i in $tablesName
do
  printf "\rTableCount: $((count+=1)) "
  sleep 1
done
echo
1 Like