Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!husc6!seismo!mimsy!cvl!umd5!cgs From: cgs@umd5.UUCP Newsgroups: comp.unix.questions Subject: Re: Is there a Bourne-shell .logout script? Message-ID: <1389@umd5> Date: Tue, 9-Dec-86 14:48:32 EST Article-I.D.: umd5.1389 Posted: Tue Dec 9 14:48:32 1986 Date-Received: Sun, 14-Dec-86 01:57:16 EST References: <502@cdx39.UUCP> <1051@ptsfb.UUCP> <1950@tektools.UUCP> Reply-To: cgs@umd5.umd.edu (Chris Sylvain) Organization: University of Maryland, College Park Lines: 35 Keywords: logout exit Bourne shell In article <1950@tektools.UUCP> jerryp@tektools.UUCP (Jerry Peek) writes: >In article <1051@ptsfb.UUCP> rob@ptsfb.UUCP (Rob Bernardo) writes: >> In article <502@cdx39.UUCP> jc@cdx39.UUCP (John Chambers) writes: >> >The C-shell runs a script called $home/.logout when you tell >> >it to log you out. Is there any way to get the Bourne shell >> >to do something similar? >> >> How about putting: >> trap "$HOME/.logout" 0 >> in your .profile (or in /etc/profile)? > >Not quite. Unless your Bourne Shell is different than mine (4.3BSD), >this trap *starts a child Bourne Shell* to read the .logout file. >This means that shell variables and stuff you've set in your >login shell *won't be available* when the .logout file is read. > > ... >The fix is easy... use this "trap" instead: > trap ". $HOME/.sh_logout" 0 >The leading "." tells the login Bourne shell to read the ".sh_logout" file >directly into itself, instead of spawning a child shell. (I name mine >".sh_logout" because it has Bourne-shell contents that csh would choke on.) > Unless your "man page" for "sh" is different than mine (4.3BSD), the first trap will perform the function desired, while 'trap ". foo" 0' will execute the file 'foo' AND RETURN when signal 0 is encountered. See the section entitled "Special Commands". -- --==---==---==-- .. And hast thou slain the Jabberwock? .. ARPA: cgs@umd5.UMD.EDU BITNET: cgs%umd5@umd2 UUCP: ..!seismo!umd5.umd.edu!cgs