[Linux-disciples] Monitoring the contents of ~/Mail
Stephen R Laniel
steve at laniels.org
Mon Jun 7 19:04:51 EDT 2004
On Tue, Jan 06, 2004 at 04:09:15PM -0500, Adam Kessel wrote:
> Right. That's bash. bash watches the contents of $MAIL. But I don't know
> of any way to have it watch more than one mailbox. (a quick test of
> colon delimited filenames in $MAIL reveals that that doesn't work).
> There are a variety of other mailbox watching command line tools, as well
> as panels, and of course the mutt mailboxes command, but I don't know any
> way to have bash itself report on the contents of anything other than
> $MAIL, which is just one file.
I just stumbled upon this URL
http://www.caliban.org/bash/
and remembered the above thread. Check it out:
$MAILPATH
bash will warn you of new mail in any folder appended to
MAILPATH. This is very handy if you use a tool like procmail
to presort your e-mail into folders.
Try adding the following to your ~/.bash_profile to be
notified when any new mail is deposited in any mailbox under
~/Mail.
MAILPATH=/var/spool/mail/$USER
for i in ~/Mail/[^.]*
do
MAILPATH=$MAILPATH:$i'?You have new mail in your ${_##*/} folder'
done
export MAILPATH
unset i
If you use mutt and many of those folders don't receive
automatically filtered mail, you may prefer to have bash
alert you only when new e-mail arrives in a folder that you
also track in mutt.
In that case, try something like the following in your
~/.bash_profile:
MAILPATH=`perl -ne 's/^mailboxes // && chomp && s/~/$ENV{HOME}/g && s/ |$/?You have new mail in your \\$\\{_##*\/} folder:/g && chop && print && exit' < ~/.muttrc`
--
``We need more bunnies listening to The Connection with
Dick Gordon and less wars in Iraq.''
-Fafblog!, http://shorl.com/byhapedegradra
More information about the Linux-disciples
mailing list