Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

Shell script to scroll down the whole text in terminal without modifying it

I'm trying to use a /bin/sh script to scroll down a couple of lines of text in terminal. A solution using smcup, rmcup is not acceptable in this case.
tput cup 0 0; tput ri
tput cup 0 0; tput rin 3

To scroll text down, a program goes to the top left corner of the screen and sends the ri (reverse index) string. The strings ind and ri are undefined when not on their respective corners of the screen.

The output of terminal has to be scrollable before running any tests (try using set, env prior to tests).

A solution for xterm will suffice.

To speed up tests and clarify use this script to start:
#!/bin/sh

# create scrollable text
set

# includes correction from JdeBP
# try to scroll text down one line
tput cup 0 0; tput ri

# includes correction from JdeBP
# try to scroll text down 3 lines
tput cup 0 0; tput rin 3
by

1 Answer

Kajalsi45d
tput cup 0 0
tput ri


Very simple.

Login / Signup to Answer the Question.