Bash: go to the bottom of the terminal

I want to do the same as the "top" command on exit:

Print something on the screen, then go to the bottom of the terminal window so that the tooltip is on the bottom line.

(If I just print 1000 blank lines, I will lose what I printed on the screen, so I need a more elegant solution to get to the bottom of the terminal window)

How to achieve this in bash?

+4
source share
2 answers
tput cup $(tput lines) 0 

, tput cup X Y X, Y ( .) tput lines tput li X . , tput li terminfo, , tput cup 1000 0 ( , tty 1000 !) - , , " ", , : clear; tput cup 5 0; printf hello; sleep 1; tput cup 5 0; printf world; tput el; tput cup $(tput li) 0

+6

bash LINES COLUMNS, , .

:

echo -ne "\E[${LINES};0H"

ansi.

0
source

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


All Articles