Using tput to save, clear and restore the terminal contents

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:

tput smcup

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

commandlinefu.com

by David Winterbottom (codeinthehole.com)

URL: http://feedproxy.google.com/~r/Command-line-fu/~3/up-H9KjOKPo/using-tput-to-save-clear-and-restore-the-terminal-contents

\"Reblog

About Amit Agarwal