Multi-line terminal status indicator?

In the terminal, if I output a one-accurate progress indicator of some kind, in place of \r will do the trick:

 while (1) { echo "progress indication\r"; } 

However, I have an indicator of progress, which really should be multi-line. Since \r only returns to the beginning of the current line, I want something that can move across multiple lines. Is there a control character / function that allows me to indent lines in the terminal?

Edit: in case I wasn’t completely clear, I want to have something roughly the opposite of \v , a vertical tab that moves the terminal cursor down the line.

+4
source share
1 answer

There is no escape character to return to the previous line, but depending on the type TERM = ANSI escape may do the trick.

 echo -e "\033[2A" 

Here is a list that might be more useful: http://en.wikipedia.org/wiki/ANSI_escape_code and for use in the shell http://www.linuxselfhelp.com/howtos/Bash-Prompt/Bash-Prompt-HOWTO-6 .html

+2
source

Source: https://habr.com/ru/post/1333896/


All Articles