The msgchk command will tell you whether there's mail waiting for you. Here's an example:
% msgchk You have new mail waiting; last read on Mon, 09 Jan 1995 14:37:09Many UNIX hosts with local mailboxes output a message, like You have mail, if messages are waiting as you log in. If your host doesn't, you can do it by adding a call to msgchk in your shell setup file (.login, .profile). To suppress the message when there's no mail, save the msgchk output in a shell variable and test the exit status. A non-zero status means that there were no messages -- or some other problem. The next Example shows how:
Example: Automatic mail check in shell setup file
Bourne and Korn shells:
if msgs=`msgchk` then echo "$msgs" fi
set msgs=(`msgchk`) if ($status == 0) echo "$msgs"mgschk also works across a network with POP; the Section Using MH with POP has basic information.
[Table of Contents] [Index] [Previous: More About scan] [Next: Other Features of inc]
This file is from the third edition of the book MH & xmh: Email for Users & Programmers, ISBN 1-56592-093-7, by Jerry Peek. Copyright © 1991, 1992, 1995 by O'Reilly & Associates, Inc. This file is freely-available; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. For more information, see the file copying.htm.
Suggestions are welcome: Jerry Peek <firstname.lastname@example.org>