Re: "sub-routine" in procmailrc
[email protected] Fri, 10 Nov 2017 08:17:33 -0600 (CST)
| Newsgroups | gmane.mail.procmail |
|---|---|
| Message-ID | <[email protected]> |
On Sun, 15 Oct 2017, udi M wrote: > Date: Sun, 15 Oct 2017 18:33:48 +0300 > From: udi M <[email protected]> > To: [email protected] > Subject: Re: "sub-routine" in procmailrc > > 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 certa= in >> > > conditions? I thought of using separate 'rc' files to "go to" from = the >> > > main rc (/etc/procmailrc or ~/.procmailrc); not sure how to impleme= nt >> > > 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 } I only get time to try it out now - works beautifully! Only something to = update the thread: 1. It is "INCLUDERC =3D rcfile", not "INCLUDE =3D ..."; 2. An alternative "SWITCHRC =3D another.rcfile" can be very useful also. Zhiliang