procmail
[Top] [All Lists]

Re: Variable greater/less than testing

2009-08-24 17:22:12
Professional Software Engineering wrote:
Procmail can perform some basic math via use of the scoring functionality, though that's not what scoring was intended for, so it's a bit obtuse. For more involved math, you can always use 'bc' and assign the results to a variable inside procmail (though this would be processor costly if done frequently).

Perhaps you could give a concise example of what you're trying to accomplish?

        maxValue=256000

        :0
        * $     ${foo:+!}
        {
                foo=${maxValue}
        }

At the moment, if 'foo' isn't set or is set, but null, it gets assigned $maxValue. Now let's say foo is set to "foobar", I would need to recognise it's not a number (perhaps -eq 0), and then like before, assign it $maxValue.

I would probably want to make sure the value assigned to foo is within certain min/max limits which is why I need to work out a simple way of implementing less/greater than.

At the moment I use ?? to test for equality.

Thanks,
Steve
____________________________________________________________
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

<Prev in Thread] Current Thread [Next in Thread>