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

Re: Clear screan question



Tim van Erven wrote:
> 
> 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:

Well, those are Control-L's, not "^L" literally.  Your way works too.
> 
> 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.

I was just guessing on the number of linefeeds needed.  Once I had
enough I was too lazy to go back and find the minimum. :-)
 
> It's still got a hackish feel about it however. Anyone know if there's
> a cleaner way to do this?

Not that I can see, though I'd love to know of a clean way to clear the
scroll-back buffer.  I agree it's a bit hackish.  Can anyone come up
with something better?

wes schreiner



Reply to: