Overwrite previous output in Bash instead of appending it
- by NES
For a bash timer i use this code:
#!/bin/bash
sek=60
echo "60 Seconds Wait!"
echo -n "One Moment please "
while [ $sek -ge 1 ]
do
echo -n "$sek "
sleep 1
sek=$[$sek-1]
done
echo
echo "ready!"
That gives me something like that
One Moment please: 60 59 58 57 56 55 ...
Is there a possibility to replace the last value of second by the most recent so that the output doesn't generate a large trail but the seconds countdown like a real time at one position? (Hope you understand what i mean :))