Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-crg!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: net.sources Subject: Re: checkmail (a cute little mailchecking utility) Message-ID: <996@hoptoad.uucp> Date: Thu, 14-Aug-86 22:56:20 EDT Article-I.D.: hoptoad.996 Posted: Thu Aug 14 22:56:20 1986 Date-Received: Fri, 15-Aug-86 05:46:54 EDT References: <561@sunybcs.UUCP> Reply-To: tim@hoptoad.UUCP (Tim Maroney) Organization: Centram Systems, Berkeley Lines: 37 It's been a while since I mentioned this trick I worked up a cuple of years ago, so I thought I'd distribute it again: The problem is that most of us have mailboxes which have back mail in them, so the login message "You have mail." tells us nothing. Scanning the mailbox takes too long on login. What we really want to know is whether mail arrived while we were logged out. A few commands in the .login and .logout scripts suffices to do this easily, quickly, and efficiently. (This version is for csh; I'm sure a similar approach would work for sh, but I don't feel like researching that silly old thing...) The approach is that at logout you touch an empty file in your home directory, and at login compare the date of the file to the date of your mailbox. If the date on the mailbox is newer, then new mail has arrived, and the login script so informs you. Here is the line in the .logout file, where the name of the empty file is ".m" in the home directory: touch ~/.m And here are the commands in the .login file: set m=`ls -t $mail .m` if ($m[1] == /usr/spool/mail/tim) then echo Read your mail, why don\'t you\? endif To start up the system, you will have to create the .m file in your home directory; the easiest way is probably "cat > .m" followed by an end of file. -- Tim Maroney, Electronic Village Idiot {ihnp4,sun,well,ptsfa,lll-crg,frog}!hoptoad!tim (uucp) hoptoad!tim@lll-crg (arpa) Give me food, or give me slack (or kill me).