Article pages now have a discussion option at the bottom (moderated/captcha, but no registration needed)

Save and restore terminal/screen content

Keywords: terminal,screen,save,restore
Contributor: Greg Wooledge (greycat at #bash on Freenode)

This cool hack uses the terminal capabilities (see terminfo(5) manual) smcup and rmcup to save and restore the terminal content.

For sure, you’ve already seen those programs that restore the terminal contents after they did their work (like vim).

# save, clear screen
tput smcup
clear

# example "application" follows...
read -n1 -p "Press any key to continue..."
# example "application" ends here

# restore
tput rmcup

Discussion

Enter your comment
 
snipplets/screen_saverestore.txt · Last modified: 2009/02/24 07:18 (external edit)
GNU Free Documentation License 1.2
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0