procmail
[Top] [All Lists]

double negatives

2003-08-12 08:39:19
Scott Wiersdorf wondered,

I'm not sure how procmail will interpret something like this:

    * $ -${MAXSPAM}^0

when MAXSPAM is -6.3 (i.e., double negative), for example.

It doesn't apply here -- MAXSPAM couldn't logically be less than zero -- but I had reason to try subtracting a possibly negative value in another use a few years ago.

Procmail expands the variable first and then decides that anything containing "--" is not a number, so you get an error.

Here is a working method for subtracting a value of either sign:

 * $ $variable^-2 HOST ?? ^^.|.^^

OK, it requires that $HOST be at least two characters long, but is it ever not? I chose HOST because it's a read-only variable that the user can't possibly have successfully unset or changed earlier in the rcfile, and it cannot begin or end in a newline.


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail