Re: command-line biff?
on Sun, 23 Feb 2003 12:25:23PM -0500, sean finney insinuated:
> On Sun, Feb 23, 2003 at 11:38:29AM -0500, Nori Heikkinen wrote:
> > > take a look at mailstat (comes w/procmail), which might do
> > > something along the lines of what you're interested in.
> >
> > this only uses procmail logs, though, right? and i can't see how
> > to make it tell me just what's *new* in the mailbox?
>
> right. the idea is that you use it without -k, such that it
> truncates the log every time you call it, and if there's mail in the
> log, it's new. of course if you've already read it it doesn't
> matter, so this program does have its deficiencies.
right -- i want it pretty much to be a console version of xbuffy, but
without the programmable middle button. so any time i call it, i want
said utility to read in a list of mailboxes (for ease i'm just using
my ~/.xbuffy file), and then tell me how many new are in each -- if
i've just marked them as new, or if they've been sitting as "new" in
my box for weeks.
> plus, if you want to actually keep your logs around for posterity...
well, i look at them if i think i'm not receiving mail, or if a recipe
i wrote is weird and i want to see where something's going, so it
would be nice to not clobber them every time i call this.
> how does your script do this?
BOXES=`egrep ^box $HOME/.xbuffy | sed 's/^box ~\///'`;
for box in `echo $BOXES`; do
MAIL=`ls $HOME/$box/new/`;
pieces=0;
for i in `echo $MAIL`; do
pieces=$(($pieces+1));
done;
if [[ ( $pieces>0 ) ]]; then
echo -n "$box: $pieces new message";
if [[ ( $pieces>1 ) ]]; then
echo "s";
else
echo;
fi;
for j in `echo $MAIL`; do
# prints the Subject and From on the same line
echo -n " " &&
echo -n `egrep ^From: $HOME/$box/new/$j` | sed 's/From: //';
echo -n " : " &&
echo `egrep ^Subject: $HOME/$box/new/$j` | sed 's/Subject: //';
done;
fi;
done
i realize this is not a fine piece of code, but it does what i want it
to, which is this:
merlin:~> clbiff.sh [33]
Mail/inbox: 5 new messages
"Florian Nimmerrichter" <f.nimmerrichter@ceranova.at> : Re: wien
"Sibley" <tim.sibley@streamsage.com> : Re: Small world
Danny Loss <dloss1@swarthmore.edu> : ldc
Mail/debian-user: 2 new messages
Nori Heikkinen <nori@sccs.swarthmore.edu> : Re: [OT] hardware failure
Ismael Valladolid Torres <ismaeval@terra.es> : Re: command-line biff?
Mail/slug: 1 new message
gabriel rosenkoetter <gr@eclipsed.net> : Re: colored threads
</nori>
--
.~. nori @ sccs.swarthmore.edu
/V\ http://www.sccs.swarthmore.edu/~nori/jnl/
// \\ @ maenad.net
/( )\ www.maenad.net
^`~'^
Reply to: