Expression evaluation identifier Expression evaluation identifier |
||||||||||||||||||||||||||||||||||||||||
Usage |
||||||||||||||||||||||||||||||||||||||||
$(<expression>) |
||||||||||||||||||||||||||||||||||||||||
Description |
||||||||||||||||||||||||||||||||||||||||
Evaluates <expression> and returns its result. If <expression> is a single string, array or hash, it is returned unmodified. In any other case the expression evaluation returns a numeric value, either real or integer. The expressions are really close to the C ones and have some minor extensions. The supported operators are +, -, *, /, |, &, ^, ||, &&, ^^, >>, <<, <, >, <=, >=, ==, != and <> (synonym for !=). The following table describes their meaning.
The integer constants can be also specified as hexadecimal numbers by prefixing them by '0x'. The string constants should be enclosed in quotes. |
||||||||||||||||||||||||||||||||||||||||
Examples |
||||||||||||||||||||||||||||||||||||||||
echo $(10 + 5 * 100) echo $(10 / 3) echo $(10 / 3.0) echo $(10.0 + 5 * 100) echo $(145 & 2) echo $("hello" > "ciao") echo $(10 == "10") %a = 100 %b = 50.3 %c = "test" echo $(%a + %b) echo $("%a%b" + 1) echo $(%a + %b > %c) echo $(-(10 + 20) * 3) echo $(1 ^ 2) echo $(1 ^ 1) echo $(0xffff == 65535) ... | ||||||||||||||||||||||||||||||||||||||||