I want to implement a progress bar showing elapsed seconds in bash. For this, I need to erase the last line shown on the screen (command \"clear\" erases all the screen, but
Use the carriage return character:
echo -e "Foo\rBar" # Will print "Bar"