Bash编程:如何在不同的"shell"中运行程序,类似于CLI命令more | less等

xla*_*ash 0 linux bash shell

我的目标是从我的主shell运行一个程序,然后清除屏幕,显示这个新清除的shell中的所有输出,直到我的程序退出.那时,我不想在我的屏幕历史中看到这个程序的所有输出.但我不想失去以前的历史.

清除,重置,清除&& printf'\ e [3J'不起作用.Subshel​​l保留历史记录,也不起作用.

谢谢

Eri*_*elt 5

尝试这样的事情:

#!/bin/sh
tput smcup    # Save the display
...
echo 'Your program stuff...'
...
tput rmcup    # restore the display
Run Code Online (Sandbox Code Playgroud)