On Sun, Apr 24, 2005 at 11:07:40PM +0430, Hossein Movahhedian wrote:
Finally one question: Basically, how can I test a regular
expression with procmail? A simple recipe please if possible.
Looked to me like Ruud gave you exactly that: a test rcfile with
a few lines in it, which you execute on the command line.
Here, again, were his instructions, copied and pasted from the
message a couple of items up in the current ones I'm reading now:
Example of such a test:
#test.rc
SHELL = '/bin/sh'
DEFAULT = '/dev/null'
VERBOSE = 'on'
HEADERLINE = 'From: "James" <*******X(_at_)example(_dot_)com>'
:0
* HEADERLINE ?? ^From:.*\"James\".*<\*\*\*\*\*\*\*+[^(_at_)]+@[^>]+>
{ var = TRUE }
Test with:
$ procmail ./test.rc < /dev/null
-------------------
So you make a small test rcfile, and you run procmail on the command
line and test it. The output comes to the screen as the default logfile
when no logfile has been defined.
There are a number of ways to do this and similar things. My
point-n-shoot script is also one way. That script presets the SHELL,
DEFAULT, and VERBOSE as ruud did above. (You can override them
if you insist, but those are the script defaults.) Here's an example:
11:06pm [~/Mail] 215[0]> cat test.rc
SAMPLETO = 'To: John Q. Public ********
<john(_dot_)q(_dot_)public(_at_)foo(_dot_)bar>'
:0
* SAMPLETO ?? [*]{3}
{ TRYONE = TRUE }
:0 E
* SAMPLETO ?? [*]\{3\}
{ TRYTWO = TRUE }
:0 E
* SAMPLETO ?? [*][*][*]
{ TRYTHREE = TRUE }
11:07pm [~/Mail] 216[0]> vsnag.point-n-shoot.sh --rc test.rc
procmail: [14848] Sun Apr 24 23:07:10 2005
procmail: Assigning "VS_DIAGS=./vsnag.self-test.rc"
procmail: Assigning "VS_MYVARS="
procmail: Assigning "PROCMAIL=procmail"
procmail: Rcfile: "test.rc"
procmail: Assigning "SAMPLETO=To: John Q. Public ********
<john(_dot_)q(_dot_)public(_at_)foo(_dot_)bar>"
procmail: No match on "[*]{3}"
procmail: No match on "[*]\{3\}"
procmail: Match on "[*][*][*]"
procmail: Assigning "TRYTHREE=TRUE"
procmail: Assigning "LASTFOLDER=/dev/null"
procmail: Opening "/dev/null"
From foo(_at_)bar Sun Apr 24 23:07:10 2005
Folder: /dev/null 5720
--
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