procmail
[Top] [All Lists]

Re: PIPE in a envvar?

1997-04-10 15:51:00
lists(_at_)professional(_dot_)org writes:
I wanted to change my $DEFAULT to gzipping (since I no longer actually read
mail under UNIX on the system, I don't need it to be in folder format).

I'm wondering, without boffing myself, whether I can set up an envvar in
.procmailrc like so:

$DEFAULT=| gzip -9fc>>$MAILDIR/mbox.gz

First of all, you only use a dollarsign when expanding variable, never
when assigning.

When procmail is looking at an action, it determines what type of action
it is (nested block, pipe to program, pipe to sendmail, mailfolder(s))
*before* variable expansion takes place.  This means that:

        FOO = "|gzip >>$HOME/foo"
        :0
        $FOO

will *not* do what you want.  The '|' has to be in the action line itself.


The correlary of this, is that the implicit DEFAULT and ORGMAIL
processing done by procmail can only deliver to mailfolders, never to
programs.  If you want to do that, you'll need to explicitly put it at
the bottom of your .procmailrc.  Yes, life is hard.


That said, I'll not the one odd-case: the mailfolder "|" is treated
internally as a 'mailfolder' and not a program, and it causes procmail
to write the message to stdout.  The following:

        FOO = "|"
        :0
        $FOO

will write the message to stdout.  If you think of it as a mailfolder
of /dev/fd/1, then it'll make more sense (/dev/fd/1 is a process's own
stdout).  Therefore, the line
        DEFAULT = "|"
will work.


...
Then, at the bottom of my recipes, still be able to invoke it like so:

:0 c
* LASTFOLDER ?? ^^^^
! forward_address

:0 Ac: $TEMP/Default$LOCKEXT
$DEFAULT

Just expand $DEFAULT by hand here and it'll work.  I don't think you
meant to put the 'c' flag on the second recipe either.


Philip Guenther

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