progressbar

Writing always in the same line in bash

Have you ever wanted to write a bunch of words just in the same line over and over again?
Many applications, like encoders or converters, do that in order to show dynamic information to the user without filling up the screen (and thus the terminal buffer).

Here is how you can do it easily in bash.

The code is quite simple:

while :; do
echo -n -e "\r$(date)"
sleep 1
done

The trick consists of three parts: