From owner-freebsd-questions Fri Aug 21 13:40:15 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id NAA27039 for freebsd-questions-outgoing; Fri, 21 Aug 1998 13:40:15 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from plaidsocks.com (c657209-a.cstvl1.sfba.home.com [24.1.81.222]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id NAA27034 for ; Fri, 21 Aug 1998 13:40:14 -0700 (PDT) (envelope-from stefan@csudsu.com) Received: from localhost (stefan@localhost) by plaidsocks.com (8.8.8/1.3.2) with SMTP id NAA10905; Fri, 21 Aug 1998 13:38:15 -0700 (PDT) (envelope-from stefan@csudsu.com) Date: Fri, 21 Aug 1998 13:38:15 -0700 (PDT) From: Stefan Molnar X-Sender: stefan@c657209-a.cstvl1.sfba.home.com To: Roman Katsnelson cc: "q's" Subject: Re: "clear" curiosity In-Reply-To: <35DDC102.CE22AD57@graphnet.com> 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 if you do not do the exec it is fine. Because after the exec is done then it will kill the process that kills it. So when doing the clear command it calls /bin/sh that calles the exec Then when exec is done the /bin/sh dies, leaving you with the shell you logged in with. If you think that clear is strange then look at the script that is /usr/bin/clear in Solaris. Stefan On Fri, 21 Aug 1998, 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 > 2) How can I write a shell script that does the same thing? (I tried, > but, of course, it did exactly what 'clear' does). > > Thanks for any ideas, > > Roman > > > -- > Roman Katsnelson > Graphnet, Inc. > romank@graphnet.com > > 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