procmail
[Top] [All Lists]

Re: formail oddity

2005-04-22 03:55:35
On Thu, Apr 21, 2005 at 07:42:14PM -0700, Bart Schaefer wrote:

On 4/21/05, Dallman Ross <dman(_at_)nomotek(_dot_)com> wrote:

I've decided for now the default input could be /bin/test.  How
does that sound?

Let me see if I understand this correctly.

You want to run procmail regardless of whether you have any
useful input for it.  Sometimes you might actually have a
multi-message file to process, so you want to use formail in that
event, but other times you might not have any file at all, and
rather than test whether you need formail, you want to use it all
the time and feed it a dummy file if the input would otherwise be
empty?

That is all correct.

There must be a better way.

Well, but it's just a shell script that gets operated on
interactively.  Although I try to write any code with high
efficiency and elegance in mind, in the final analysis a script
such as this one causes no appreciable load, and whether it takes
2/1000ths of a second longer or shorter to run is meaningless.  A
test for the existence of a multi-message file is also work.  The
extra code for various alternatives in various cases is likewise
messy.  It seems to me to be cleaner, and simple, to just have one
line that works regardless of how I implement it.

The script is not intended to be called from a procmail rcfile
or otherwise used automatically or under possible load.

I was in any case surprised to find that formail's implementation
adds a requirement to the procmail execution -- of an input stream
of greater than zero bytes -- taht procmail does not itself
require.

If you have any other suggestions, feel free to send them my way.
Ruud emailed me and demonstrated that

   echo -n ' ' | formail -s procmail [args]

works, which is interesting and usful, but leaves behind the
practical question of how best to code into a shell script the
multiple options you cite above.


In any event:

schaefer[501] ls -l =formail =test
-rwxr-xr-x    1 root     root        27724 Mar  5  2004 /usr/bin/formail*
-rwxr-xr-x    1 root     root        22140 Mar 16  2004 /usr/bin/test*
schaefer[502] ls -l /bin/test
ls: /bin/test: No such file or directory

That's a RedHat EL3 Linux system.  (The =foo syntax is a zsh-ism.)

Okay.  I appreciate that bit!  Thank you.

-- 
dman

____________________________________________________________
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

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