Hi!
from the core cookbook of 1.2:
If you want to evaluate arithmetic operations and test the value in conditions, use the test operator ' [ ... ] ' . This is required to convert the result to internal convention for drop, true and false.
if ( [ $var(a)&4 ] ) { xlog("bit 3 is set in var a"); }
Is there somewhere a detailed description of the test operator? Can it only be used to test for 0/1 or can I also do comparison like e.g. if ([ $rd == "mydomain.at" ]) ?
regards klaus
Hi Klaus,
the [..] operator is used to convert generic numerical value (maybe result of arithmetic ops to logical value.
in your example, the == is already a logical operator, so no need to any conversion.
regards, bogdan
Klaus Darilion wrote:
Hi!
from the core cookbook of 1.2:
If you want to evaluate arithmetic operations and test the value in conditions, use the test operator ' [ ... ] ' . This is required to convert the result to internal convention for drop, true and false.
if ( [ $var(a)&4 ] ) { xlog("bit 3 is set in var a"); }
Is there somewhere a detailed description of the test operator? Can it only be used to test for 0/1 or can I also do comparison like e.g. if ([ $rd == "mydomain.at" ]) ?
regards klaus
Users mailing list Users@openser.org http://openser.org/cgi-bin/mailman/listinfo/users