On Wed, Jul 23, 2003 at 09:53:34AM -0500, David W. Tamkin wrote:
Jeffrey Parker had,
P>INBOXSIZE=`ls -l ${ORGMAIL} 2>/dev/null | awk '{print $5}'`
Dallman Ross suggested,
R>Why not just
R> INBOXSIZE = `wc -c < $ORGMAIL 2>/dev/null`
Paul Chvostek commented,
C> I think it's debatable whether you generate more load by parsing the
C> directory listing through a two-part pipe versus shovelling the
C> entire mailbox into a smaller pipe. Of the two solutions, I'd go for
C> the directory entry, so that a 20MB mailbox didn't generate 20MB of
C> data being read from the disk every time a message comes in.
OK, but since both approaches invoke $SHELL anyway, I think we can get
the best of both worlds:
:0i
INBOXSIZE=| set -- `ls -l $ORGMAIL` ; echo $5
or if you use anything in the csh family as $SHELL,
:0i
INBOXSIZE=| sh -c 'set -- `ls -l $ORGMAIL` ; echo $5'
I'm not sending stderr to /dev/null, because if $ORGMAIL can't be ls'ed,
I'd like the logfile to tell me!
That's really very good, David, thanks.
As for whether $ORGMAIL can be ls'd, though, it's certainly permissible
for the inbox to have been downloaded and hence not exist. That's
what I thought of when I first saw that "2>/dev/null", anyway.
--
dman
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail