procmail
[Top] [All Lists]

Re: "sub-routine" in procmailrc

2017-10-15 10:53:57

On 09/10/17 19:28, Zhiliang Hu wrote:
On Mon, 9 Oct 2017, Ruud H.G. van Tol wrote:

Date: Mon, 9 Oct 2017 16:50:57 +0200
From: Ruud H.G. van Tol <rvtol(_at_)isolution(_dot_)nl>
To: procmail(_at_)lists(_dot_)rwth-aachen(_dot_)de
Subject: Re: "sub-routine" in procmailrc

On 2017-10-09 16:43, Zhiliang Hu wrote:

This may be naive but I have not found how to - in procmailrc is it
possible to have a sub-set of rules that can be re-used under certain
conditions? I thought of using separate 'rc' files to "go to" from the
main rc (/etc/procmailrc or ~/.procmailrc); not sure how to implement
the scheme. E.g. Is "incldue" a right way?=A0 Will appreciated any
suggestions.

Re. usage of includes, see for example
https://rvtol.home.xs4all.nl/procmail/demo/basic/

-- Greetings, Ruud

Thanks! But I guess conditional includes like these would work?

:0
* CONDITION A
INCLUDERC = "$INCDIR/recipesA"

:0
* CONDITION B
INCLUDERC = "$INCDIR/recipesB"

:0
* CONDITION C
{
 :0 c
 INCLUDERC = "$INCDIR/recipesC"

 :0
 INCLUDERC = "$INCDIR/recipesA"
}

?

Yes,  Also, in some cases based on the MATCHing you can do:

:0
*  theLeftSide\/thePaternYouRlookingFor
{ INCLUDE = $INCDIR/recipes$MATCH }

instead of  case A, case B, etc...


For example:

0:
* Subject: .*simester:[ ]+\/([AB]|Summer)
{ INCLUDE = $INCDIR/simester$MATCH }


--udi



--
Zhiliang
____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)rwth-aachen(_dot_)de
https://mailman.rwth-aachen.de/mailman/listinfo/procmail

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)rwth-aachen(_dot_)de
https://mailman.rwth-aachen.de/mailman/listinfo/procmail

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