0

I wrote nice PS1 formatter:

PS1='\n===============================================\r$?|\u@\h \w \nbash# '

which shown prompt like:

0|user@desktop ~/devel/emacs ===================================
bash#

I use trick with \r to return cursor to the first line position, so output goes over ====... like string.

Does any terminal support \r (carriage return) and \b (backspace)?

Do I need to query for support in termcap / terminfo if isatty() return true?

I see \r usage in wget / curl / git / hg / etc when utility shown progress.

Also \b is used when application shown progress sequence in single rotating position:

while true; do for x in '|' '/' '-' '\'; do printf '\b$x'; sleep 1; done; done

NOTE Please don't post images with type machines. Think about modern hardware or software emulators.

gavenkoa
  • 45,285
  • 19
  • 251
  • 303

0 Answers0