Path: utzoo!utgpu!water!watmath!clyde!rutgers!cmcl2!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.unix.questions Subject: Re: Logging the ^d logoff Message-ID: <7255@brl-smoke.ARPA> Date: 12 Feb 88 17:28:05 GMT References: <209@mccc.UUCP> Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 14 In article <209@mccc.UUCP>, pjh@mccc.UUCP (Peter J. Holsberg) writes: > One suggestion, which came very close, was to trap 0 1 3 with a line in > /etc/profile so that on ^d logout (or hangup, etc.) a line with "who am > i" information would be written to /usr/.logins. I found that this > worked quite well except for one thing: despite the fact that the login > time is accurate, the logout time is always about one second after the > login time, regardless of the actual logout! I suspect the only problem is that you forgot that the arguments to the "trap" built-in would be evaluated twice, once at the time of executing the "trap" built-in, and once (with whatever the result of the first evaluation was) when the trap fires at logout time. Once you realize this, the solution is obvious: quote the "who am i" so that it will not be evaluated when "trap" is set.