« Back to Index

Bash update current line when echoing updating output

View original Gist on GitHub

Bash update current line.md

Update current line when echoing updating output:

echo -ne "Movie $movies - $dir ADDED! \033[0K\r"

Here is a small example that you can run to understand its behaviour:

#!/bin/bash
for pc in $(seq 1 100); do
    echo -ne "$pc%\033[0K\r"
    sleep 1
done
echo