Displaying and updating a counter in bash
for i in {0..15}; do echo -ne "$i"'\r'; sleep 1; done; echo
You don't need ..1 for stepwidth 1 which is default.
echo -n
prevents newlines.
\r
is returning to begin of line (without newline - \n
), and better than my formerly used '\b' for backstepping a single character, unhandy, if you have more than one digit-numbers. Thanks to rozcietrzewiacz.