procmail
[Top] [All Lists]

Re: Procmail and Notification?

1996-04-27 07:14:07
#!/bin/sh

USER=${USER:-reriksso}
MAIL=${MAIL:-/usr/spool/mail/${USER}}
HOME=${HOME:-/home/kruuna3/ykiel/${USER}}

while read mailbox name; do
    test -s $mailbox && msgs=`grep -c '^From ' $mailbox` &&
        printf "%-18s %3i messages\n" $name: $msgs
done<<HEDE

Is this something present in newer bourne shells?  Mine doesn't
recognize "printf".

Anyway, replacing the "printf" line with:
        echo $name: $msgs | awk '{printf "%-18s %3d messages\n",$1,$2}'
seems to work, and will probably do better with older shells.

Note that this will also count any '^From ' text in message bodies,
unless this was "escaped" before delivered to the mailbox.

Cheers,
Stan Ryckman (stanr(_at_)tiac(_dot_)net)

<Prev in Thread] Current Thread [Next in Thread>