Re: "sub-routine" in procmailrc

udi M <[email protected]> Sun, 15 Oct 2017 18:33:48 +0300
Newsgroups gmane.mail.procmail
Organization tau
Message-ID <[email protected]>
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 <[email protected]>
>> To: [email protected]
>> 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?=3DA0 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 =3D "$INCDIR/recipesA"
>
> :0
> * CONDITION B
> INCLUDERC =3D "$INCDIR/recipesB"
>
> :0
> * CONDITION C
> {
>  :0 c
>  INCLUDERC =3D "$INCDIR/recipesC"
>
>  :0
>  INCLUDERC =3D "$INCDIR/recipesA"
> }
>
> ?

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

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

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


For example:

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


--udi


>
> -- =

> Zhiliang
> ____________________________________________________________
> procmail mailing list   Procmail homepage: http://www.procmail.org/
> [email protected]
> https://mailman.rwth-aachen.de/mailman/listinfo/procmail