ddave(_at_)ddave(_dot_)com commented on Dan Smith's post,
| On Fri, 6 Jun 1997, J. Daniel Smith wrote:
| --
| > Here's what I do:
| >
| > # be sure all messages contain a Subject: line
| > :0
| > * ^Subject:
| > * !^Subject:[ ]*(Re:?)*[ ]*$
| > { }
| ^^^
|
| I believe I follow the recipe till I get to the empty nesting brackets.
| What is their purpose?
Before I answer that, note that Dan immediately followed them with an
`else' recipe:
| > :0Ehfw
| > | formail -I "Subject: [no Subject: given in original message]"
| > SUBJECT=`formail -zx "Subject:"`
The purpose of the empty braces is a no-op to set up the `else' situation
following it. "If there is a subject, and the subject is not blank nor just
the word Re or Re:, do nothing; in all other cases, follow the :0E recipe."
Thus, if there is no subject, or if the subject is empty, blank, or
just Re or Re:, procmail goes to the :0E recipe; if there is a subject,
and it has real contents that count, procmail does nothing and skips
past the :0E part.
Sometimes it is easier to code the situation when procmail should NOT do an
action than that when it should. For those cases, we use the no-op/else
syntax.
Another use of empty braces is to save a score that could be negative or
zero:
:0
* w^x condition
* w^x condition
* ... etc ...
{ }
SCORE = $=
If we did it this way:
:0
* w^x condition
* w^x condition
* ... etc ...
{ SCORE = $= }
Then the total score would be saved in $SCORE only when it is positive.