I would like to print to a clean terminal, but not issue a clear
or reset
command such that the user will not lose data. After the printing is done, I would like to put the user in their old (root) window.
I see this done in programs like htop
, tmux
, less
and the like. My understanding is that they create a new window on top of the root, use that, and return the user to the root window when done.
How can I emulate the same behaviour in a shell script? I (think I) cannot just pipe what I want to print to less
as I need to capture the user's input.
Here's a template for what I need:
begin-window # a top-layer window is created
echo data
read input
echo processed input
read _ # press enter to exit
end-window # user is returned to the original window