On Sun, Dec 10, 2000, Shlomi Fish wrote about "[hackers-il] A script that reports whether new mail has arrived in each folder":
> I have several mail folders, in the regular flat format (not maildir). I
> wish to have a script that will tell me whether new mail has arrived in
> each one of the folders. New mail is defined as mail that has the "N" tag
> in pine.
You might want to use newmail/wnewmail (they come with elm, you most likely
you have these installed).
Alternatively, what I personally do, for exactly the situation you describe,
is to have
MAILPATH=/var/mail/nyh:/home/nyh/procmail/mail?You have new mail in $_.
(this is in zsh, but there's probably a bash equivalent if you want. It
looks in my default mailbox (/var/mail/nyh) and all mailboxes in the
This doesn't do exactly what you want (it doesn't look inside the mail and
look for the N, instead it checks if the last-modification date of the file
is newer then the last time it was read), but works beautifully: whenever I
log in I see a list of "you have new mail in ..." lines, and also before
the shell prints a prompt it checks for mail again and prints messages for
new mail that hasn't been announced yet - so I see new mail almost as soon
as it arrives (assuming I'm using the shell, and not stuck inside a long
editing session, for example).
To make things even less synchronous, and to get announcements of email
while I'm not using the shell (e.g., I tend not to be using the shell when I'm
in the bathroom) I also send announcements of "important" mail to my cellphone,
but that's another subject altogether.
Nadav Har'El | Sunday, Dec 10 2000, 13 Kislev 5761
Phone: +972-53-245868, ICQ 13349191 |Always keep your words soft and sweet,
|just in case you have to eat them.