On Tue, Aug 16, 2005 at 03:07:39PM +0100, Phillpotts, James wrote:
Hi All,
I wonder if anyone can help me with the following procmail recipe:
:0
* ^Subject:.*\[MYTAG: *\/.+\]
{
saved = $SHELLMETAS
SHELLMETAS
REALMATCH =`expr "$MATCH" : ' *\(.*\)\].*'`
SHELLMETAS = $saved
:0 w
* test ! -w $HOME/$REALMATCH
That syntax is wrong. You need a question mark.
* ? test ! -w $HOME/$REALMATCH
* ? mailutil create $REALMATCH
Where's the action line on this recipe?
You can't have an action line be another recipe start.
You can have it be an opening brace to a nested-brace set,
however.
:0 w
| /usr/bin/dmail +$REALMATCH
}
What I'm trying to with this is:
For all email that contains a preformatted tag,
[MYTAG: SomeText], move the email to the SomeText MBX mail
folder. Unfortunately, dmail will not create a non-existent
folder (unlike procmail with unix mail folders), so I am trying
to get procmail to check whether the folder exists first, and if
not, create it before filing the email.
I'm too tired to think through your recipe's logic, but my question is:
if you want to be sure there's a file, why not just use "touch"? Then
you don't have to bother with test or an alternative recipe. Nor with
SHELLMETAS. You certainly don't need that "expr" mess, either.
:0 w
* ^Subject:.*\[MYTAG: *\/[^]+
* ? touch "$HOME/$MATCH"
| dmail +$MATCH
You might or might not need a local lockfile.
This e-mail and any attachment is for authorised use by the
Oh, geez. Do you have any control over that appearing on list
messages? Please?
Dallman
____________________________________________________________
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