Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 alpha 4/15/85; site elsie.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!elsie!ado From: ado@elsie.UUCP (Arthur David Olson) Newsgroups: net.unix-wizards Subject: Re: Re: mailwatch script wanted Message-ID: <5196@elsie.UUCP> Date: Tue, 30-Jul-85 21:45:18 EDT Article-I.D.: elsie.5196 Posted: Tue Jul 30 21:45:18 1985 Date-Received: Thu, 1-Aug-85 06:21:27 EDT References: <411@sdcc12.UUCP> <319@tektools.UUCP> <160@kitty.UUCP> <2509@sun.uucp> Organization: NIH-LEC, Bethesda, MD Lines: 25 Summary: odd use for the set-user-ID bit > . . .they should have added a flag which tells "mail" to *print* a message > . . .or to return one of *three* exit statuses. That way, you can distinguish > "You have mail (because you leave stuff around in your mailbox until you've > responded to it)" from "You have mail (because some mail arrived since the > last time you looked at your mailbox).") For those running 4.?bsd and using the C shell, here's an odd way to do pull off the second trick. Add this line to your ".cshrc" file alias mail '/usr/ucb/mail \!* ; if ( "\!*" == "" ) chmod u+s $mail' (substituting for "/usr/ucb/mail" as appropriate) and this line to your ".login" file find $mail \! -perm -4000 -exec echo "You have new mail." \; (ensuring that "$mail" gets set before this point in the ".login" file). Given the alias, the set-user-id bit of your mail file will be set each time you read your mail. Given the way 4.?bsd works, the set-user-id bit is cleared each time mail is written to your file. The "find" command simply checks the bit to determine whether or not you have "new" mail. -- UNIX is an AT&T Bell Laboratories trademark. Sun is a Sun Microsystems trademark. An AT&T employee holds a patent on the set-user-ID bit. -- UUCP: ..decvax!seismo!elsie!ado ARPA: elsie!ado@seismo.ARPA DEC, VAX and Elsie are Digital Equipment and Borden trademarks