I just want to clear the screen sounds like such a simple thing. Why is it difficult? Because there are so many types of screens! Are we talking about a terminal emulator program, like xterm, rxvt, telnet? Are we talking about a physical terminal on a serial line (vt220)? Is it a line printer???? Is it a Tk text widget?
Here are a few ways:
exec clear >@ stdout ; # Most unix systems should have a clear command puts \x1B\[2J ; # for Solaris xterm - VERY terminal specific eval exec [auto_execok cls] ; # Most windows systems should have a cls exec command /c cls ; # DOS? exec >&@stdout $::env(COMSPEC) /c cls ; # Win95 $t delete 1.0 end ;# Tk text widget
Bruce Hartweg suggests
eval exec >&@stdout <@stdin [auto_execok cls]
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&th=57f93208a1685681
Pretty neat tricks ;) -- Ro
In addition the following examples clears the whole screen
1. puts \x1b[H\x1b[2J
2. exec tput clear >@ stdout
Number 2. Initializes and clears the screen.
3. puts exec clear
These are pretty handy as well!!!! ------------- Angel Sosa