Scroll instead of clear screen

A "command line interface" (CLI) has been an interactive means for typing instructions into the computer. Any command typed is either immediately invoked, or invoked after typing a specific button such as "Do" or "Engage". Sometimes the Enter button or Return button is conscripted when lacking a specific button for command invocation.

The command line is at the bottom and the lines of text are shifted upward as each command is issued, like handwritten notes or a typewriter. Any results might also be drawn on additional lines after the command, shifting the lines upward further.

Only the most recent lines of text are shown. Any prior lines beyond what can fit on the screen are no longer drawn. A common command provided in a command line interface is clear for eliminating all the text that has been drawn above the command line.

Sometimes a CLI peculiarly begins with the command line at the top and then gradually shifts it downward towards the bottom. From then on, additional lines of text are shifted upwards as done with a consistent CLI.

For such a CLI constantly shifting the location of its command line, the clear command eliminates all drawn text and replaces the command line to the top again for repeating its incongruent descent.

Instead, establish the bottom as the consistent location for the command line by drawing enough blank lines (f.e. with echo) to fill the screen from top to bottom instead of using the clear command.

# Clear the screen while keeping
# the command line at the bottom.

line_count=70
while [ $line_count -gt 0 ]
do
echo
line_count=$(($line_count - 1))
done

Also in this separate document: scroll, a script for the ash CLI.


sharing