procmail
[Top] [All Lists]

Re: Message count

1999-03-26 17:02:22
In regard to this,

| | >  formail -s echo < $MAILFILE | wc -l

about which I'd said this,

| Ah, but if the command is interpreted by a shell that has echo built in,
| then the suggestion I made that uses echo also has only two processes, and
| it sends only ONE byte per message down the pipe.  It's also a lot easier
| to type.

Bennett Todd reminded me in private email that formail will try to invoke
whatever follows -s as an executable, so having echo built into the shell
won't help, and for each message in the mbox, formail will duly fork whatever
echo executable is first in $PATH.  If echo turns out to be a shell script
that calls the built-in echo, such as this:

  #!/bin/sh
  echo "$@"

then that means invoking a shell for each message.  So thank you, Bennett;
Philip was right all along, and this is the best way:

| >     formail -I'From x' -zx'From ' -s < mailbox | wc -l

and the `z' option doesn't seem to be required with formail 3.12.

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