a suggestion i thought of after watching the net vis video..
@7:45 he uses a way of padding the line so that he can clear to end of line. the easiest way to do this is to use tput.
for example.
CLR_EOL=$(tput el)
.
echo "This is a longer line of text."
# Use a carriage return to move to the beginning of the line
# then use $CLR_EOL to clear the entire line
printf "\r%s" "${CLR_EOL}New, shorter text."
another way is t just use stadard ansi escape sequencies which is less $TERM compatible if you aren't using an ansi capable terminal.
echo "This is a longer line of text."
# \r moves to the beginning of the line, \033[0K clears to the end
printf "\r\033[0K%s" "New, shorter text."
echo # Add a final newline
a suggestion i thought of after watching the net vis video..
@7:45 he uses a way of padding the line so that he can clear to end of line. the easiest way to do this is to use tput.
for example.
another way is t just use stadard ansi escape sequencies which is less $TERM compatible if you aren't using an ansi capable terminal.