Logging the ^d logoff

Wolf N. Paul wnp at dcs.UUCP
Tue Feb 16 23:36:23 AEST 1988


In article <213 at mccc.UUCP> pjh at 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 at dcs.UUCP       ESL:  62832882



More information about the Comp.unix.questions mailing list