Clear line before carriage return
bash
Solution
You can use the `clr_eol` terminal capability for this.
printf '\r%s Processing: %s' "$(tput el)" "$x"
Notice how I moved the variable out of the `printf` format string? In general do not stick variables in the format string.
Problem
I want to print a progress - in one line. So I use a carriage return. The problem is my progress isn't increasing => this means the first print could be `Processing: Foo Bar Baz` and the next print could be `Processing: Foo` . The problem with a simple carriage return is that the second print would be overlayed by the first print. I hope you understand what I want to say.. ``` printf "\r Processing: $x" # or echo -en "\r Processing: $x" ``` So my question is: How can I delte the content of the current line and overwrite it with carriage return?