Path: utzoo!utgpu!water!watmath!clyde!burl!codas!killer!dcs!wnp From: wnp@dcs.UUCP (Wolf N. Paul) Newsgroups: comp.unix.questions Subject: Re: Logging the ^d logoff Message-ID: <13@dcs.UUCP> Date: 16 Feb 88 13:36:23 GMT References: <209@mccc.UUCP> <7255@brl-smoke.ARPA> <213@mccc.UUCP> Reply-To: wnp@dcs.UUCP (Wolf N. Paul) Organization: DCS, Dallas, Texas Lines: 36 In article <213@mccc.UUCP> pjh@mccc.UUCP (Peter J. Holsberg) writes: >Here's what's in my /etc/profile now: > >echo IN: "\t" $LOGNAME "\t" `tty` "\t" `date` >> /usr/pjh/.logins > >trap 'echo OUT: "\t" $LOGNAME " \t\c" >>/usr/.logins; `tty` >>/usr/.logins `date` >> /usr/.logins' 0 1 3 > > >The 'trap' doesnm't work. Please suggest modifications. (I've tried I tried something yesterday related to a discussion of the MKS shell (MS DOS), where someone wanted a ".logout" equivalent for the Korn shell. In /etc/profile I put the following line: trap ". $HOME/.logout" 0 1 3 and in $HOME/.logout any commands that I want executed every time I log out. This works on my Microport System V machine. Actually, the trap line in /etc/profile is within a case statement which checks for a $0 of "-sh" - since we don't want this to execute whenever we leave ANY old shell, but only when we leave the login shell. Putting whatever you want to happen on logout into a separate shell script removes all of the ambiguities and pitfalls of when it will be interpreted by the shell - it won't, until the trap is sprung and the separate shell script is read. ------- -- ------------------- Wolf N. Paul Phone: (214) 306-9101 (h) (214) 404-8077 (w) 3387 Sam Rayburn Run UUCP: ihnp4!killer!{dcs, doulos}!wnp Carrollton, TX 75007 INTERNET: wnp@dcs.UUCP ESL: 62832882