Using tput to save, clear and restore the terminal contents $ tput smcup; echo \”Doing some things…\”; sleep 2; tput rmcup Very useful for interactive scripts where you would like to return the terminal contents to its original state before the script was run. This would be similar to how vi exits and returns you to your original terminal screen.
Save and clear the terminal contents with:
Execute some commands, then restore the saved terminal contents with:
tput rmcup * View this command to comment, vote or add to favourites * View all commands by jgc
by David Winterbottom (codeinthehole.com)