|
4.2 Variables and Arithmetic ExpressionsPrivate Shell Script engine allows using variables and calculating arithmetical expressions. Variables receive their values with the specific script action Set value (it is described below) and can be used in any script action. Variables are referenced using the following syntax: $varname or ${varname} This syntax is allowed to appear anywhere in a text string, e.g. if you have a variable Friend with the value Bill, the string Hello, ${Friend}! will result in Hello, Bill!. Please note that variable substitution occurs only if you check the Preprocess parameters strings option for the current script step. Arithmetical expressions use the following syntax: ${{expression}} For example: ${{1 + 2*3}}, ${{5*sin (sqrt (2)/2)}} It is possible to use variables in the calculations (if they contain real numbers), for example: ${{$base + $index*86.5}} The following operations and mathematical functions are allowed in an arithmetical expression:
Logical operators treat operands as 32-bit integers and perform the following operations:
Boolean operators (AND, OR) differ from logical ones in that they treat operands as 1-bit integers (0 is treated as 0, any other number as 1) and are designed to be used in conditional expressions. Examples: 10 AND 4 = 1, 10 AND 5 = 1, 10 AND 0 = 0. Comparative operators return 1 if the condition is true for the given operator, and 0 otherwise, e.g.: 10 > 5 = 0, 10 <= 11 = 1. Private Shell script engine supports the following mathematical functions:
Warning: arithmetical expressions cannot be nested. When a text string is preprocessed, all arithmetical expressions are calculated first, so the string Hello, ${var${{1 + 4}}} results in Hello, ${var5}, and then a variable substitution for the var5 variable occurs.
|