On 16-Nov-2009, at 01:11, JW Simpson wrote:
1. Always use a full path when running id,date,grep,echo,rm,wc,sed, and
any other non-procmail utilities that you use. Not doing so causes a
PATH search to be launched for every single call.
Good point.
3. Use egrep instead of grep so that you can use egrep -v '(\.\.|\.)$'.
That way, you don't have to load egrep twice.
I eliminated the grep altogether.
4. Better yet, don't use the "ls -a"; use "ls -A" instead, then you
don't have to make the call to grep in the first place.
Yes, had a 'doh' moment there.
5. Don't use file I/O for temporary storage. It is extremely costly.
Use a Variable instead, and set LINEBUF beforehand to be large enough.
The trouble was I was searching many mailboxes for new messages, then I wanted
the count for each mailbox separately. I've eliminated (as I always intended to
do) the write to the summary file, but I did not see a way around the
individual files for each mailbox.
6. Why are you using echo for a null string ???
Because I don't know the syntax in bash for 'if file is zero length' or 'if NOT
(file exists and size is greater than zero) and trying to leave an empty ;
there caused an error. I kept meaning to look this up, but it's proved
difficult to find and I moved on to other things.
7. You don't even need the if statement. You can use "rm
-f /tmp/$UNAME.$DATE.$i", and eliminate 4 lines of code altogether.
No, because I am only removing the files that are zero length. The other file I
am counting the number of lines with wc. (I am removing them so I don't end up
with a list of every mailbox in every mail, most showing a '0' for the count).
The logic is if the files in non-zero length, do nothing (echo -n) otherwise
(if the file IS zero length), delete it. the files that are left, get processed
by wc -l.
I'm sure there's a better way to get the unread counts out of a maildir. I
think dovecot has this functionality, but I don't know about Courier. That will
be the next step, I think.
--
"Conservatives want live babies so they can raise them to be
dead soldiers" ~Carlin
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail