[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Clear screan question



"Karl E. Jørgensen" wrote: 
> On Fri, Jan 26, 2001 at 08:08:07PM -0500, Andy Bastien wrote:
> > Of all the days, it was on Sat, Jan 27, 2001 at 01:53:31AM +0100 that Tim van Erven quoth:
> > > On Fri, Jan 26, 2001 at 05:03:49PM -0600, wes schreiner <wes@infosink.com> wrote:
> > > > Tom Breza wrote:
> > > > >
> > > > > Hi
> > > > >
> > > > > I just use fetch and I been editing filie fetchmail, after I finish
> > > > > editing file I log off from by presing CTRL-D but above log prompt I can
> > > > > read what was been done before, is any chance to clear screan complitly
> > > > > when I log off? That when I press SHIFT-PgUp nobody can see anything?
> > > >
> > > >
> > > > Most shells have a file they will run at logout.  For bash this is
> > > > ~/.bash_logout.  In my ~/.bash_logout I have:
> > > >
> > > > echo ^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L
> > > > echo ^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L
> > > > echo ^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L
> > > > echo ^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L
> > > > echo ^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L
> > > > echo ^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L
> > > > echo ^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L^L
> > > > clear
> > > >
> > > >
> > > > The idea is to have enough Control-L's to clear out the scroll-back
> > > > buffer and the clear is there so that the next login happens at the top
> > > > of the screen.  Works like a charm.
> > >
> > > Doesn't seem to work for me. It just prints out the '^L's. I replaced
> > > it with:
> > >
> > > echo -e "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
> > > echo -e "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
> > > echo -e "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
> > > echo -e "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
> > > echo -e "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
> > > echo -e "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
> > > clear
> > >
> > > which works just fine. Notice that this is also one echo shorter which
> > > is sufficient on my potato install and saves a little time.
> > >
> > > It's still got a hackish feel about it however. Anyone know if there's
> > > a cleaner way to do this?
> > >
> >
> > If you have an ANSI terminal, you can put an ESC[2J ESC[0;0H in
> > /etc/issue.  The color codes also work, BTW.
> >
> > VTxxx terminals probably have a similar screen-clearing code, but I
> > don't know what it is.
> 
> Jumping into this thread a bit late, but what about
> 
>     tput clear
>     tput reset
> 
> Should be terminal-generic

Indeed it is, but it only clears the immediately visible screen.  It
does not clear the console scroll-back buffer, and that's the additional
behavior we are looking for.

wes schreiner



Reply to: