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

Re: Clear screan question



Alexis Paul Musgrave wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> In my .bash_logout I have:
> 
> case "`tty`" in
>     /dev/tty[0-9]) clear
> esac
> 
> This works perfectly on tty's, and I don't think you need this on
> pty's.

No, this doesn't work, at least not on vgacon or matroxfb.  Yes, the
immediately visible part of the screen is cleared, but the console
scroll-back is still there, hit Shift-PageUp after logging out and see.  

The only reason I can see to enable this for pty's would be if you want
the scroll-back of your *term cleared when you log out of a session of
ssh, telnet, or su.  Personally I like to keep the scroll-back in those
cases so my actual .bash_logout is:

# ~/.bash_logout: executed by bash(1) when login shell exits.
# when leaving the console clear the screen to increase privacy
case "`tty`" in
    /dev/tty[0-9]) 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^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^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^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^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\
    ^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^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^L^L^L^L
    clear

Those ^L are real control-L's, not shift-6, shift-L.  I'd still like to
see a cleaner way to clear the CONSOLE scroll-back.  All of the
suggestions so far (clear, reset -Q, ESC[2J ESC[0;0H in /etc/issue) just
clear the immediately visible screen, not the console scroll-back.

wes schreiner



Reply to: