From owner-freebsd-questions Fri Aug 21 14:00:38 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id OAA29629 for freebsd-questions-outgoing; Fri, 21 Aug 1998 14:00:38 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from shell6.ba.best.com (shell6.ba.best.com [206.184.139.137]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id OAA29624 for ; Fri, 21 Aug 1998 14:00:37 -0700 (PDT) (envelope-from jkb@best.com) Received: from localhost (jkb@localhost) by shell6.ba.best.com (8.9.0/8.9.0/best.sh) with SMTP id NAA23859; Fri, 21 Aug 1998 13:59:52 -0700 (PDT) X-Authentication-Warning: shell6.ba.best.com: jkb owned process doing -bs Date: Fri, 21 Aug 1998 13:59:52 -0700 (PDT) From: "Jan B. Koum " X-Sender: jkb@shell6.ba.best.com To: CyberPeasant cc: Roman Katsnelson , freebsd-questions@FreeBSD.ORG Subject: Re: "clear" curiosity In-Reply-To: <199808211934.PAA29879@lucy.bedford.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I usually do: # echo "`which clear`" > /usr/share/skel/dot.logout # chown bin.bin !$ # echo "`which clear`" > /root/.logout -- Yan www.best.com/~jkb/ Unix users of the world unite: www.{free,open,net}bsd.org | www.linux.org | www.apache.org | www.perl.com "Turn up the lights, I don't want to go home in the dark." On Fri, 21 Aug 1998, CyberPeasant wrote: >Roman Katsnelson wrote: >> Hi, >> >> I did 'cat clear' recently, and saw that all it said was >> >> exec tput clear >> >> I noticed that when I just type that in at the command line, the result >> is entirely different -- it logs me out, clears the screen and gives a >> new login prompt. I like this a lot better than the regular "exit" or >> "Ctrl-D" thing because it clears the screen first. These are my two >> questions: >> >> 1) Why are the results different between the same commands in a shell >> script and at the command line? >> and > >Well, exec replaces the current program with the other one. (tput in >this case.) > >If it's a shell script, (e.g. clear) exec replaces the sh running >the script with tput. > >>From the command line, it replaces your login shell. > >> 2) How can I write a shell script that does the same thing? (I tried, >> but, of course, it did exactly what 'clear' does). > >for reasons, see the preceding. > >Bash has a .bash_logout script, maybe other shells do. >This is the sort of thing you need to do on a system where you are >not rooted. > >Usually, a better way is to have getty clear the screen. > >Adding a "\f" to the login banner sequence in /etc/gettytab seems >to do the trick. > >Before: >default:\ > :cb:ce:ck:lc:fd#1000:im=\r\nFreeBSD (%h) (%t)\r\n\r\n:sp#1200: > >After: >default:\ > :cb:ce:ck:lc:fd#1000:im=\f\r\nFreeBSD (%h) (%t)\r\n\r\n:sp#1200: > >Note that this will affect all getty'ed logins: console, serial >lines. (But not telnet and rlogin. These can be dealt with as >well, I think, but am too lazy to dig it out.) Maybe some terminal >types will choke on the \f. > >Dave >-- > Confutatis maledictis, flammis acribus addictis. > >To Unsubscribe: send mail to majordomo@FreeBSD.org >with "unsubscribe freebsd-questions" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message