Let's use echo -n '...' $'\r'
to print a carriage return:
for ((k = 0; k <= 10 ; k++))
do
echo -n "[ "
for ((i = 0 ; i <= k; i++)); do echo -n "###"; done
for ((j = i ; j <= 10 ; j++)); do echo -n " "; done
v=$((k * 10))
echo -n " ] "
echo -n "$v %" $'\r'
sleep 0.05
done
echo
It makes the cursor move to the beginning of the line to keep printing.
Output is as follows, always in the same line:
[ ################## ] 50 %
.../...
[ ################################# ] 100 %