
Command Reference
117382-A Rev. A 2-19
Example 2
In the following script, variable name b is assigned the sum of variable name a
plus 1.
setenv a 1
let b=$a+1
The let command evaluates an expression from left to right. You can use
parentheses to change the order of the evaluation.
Use the arithmetical and logical operators listed in T
able 2-2 and Table 2-3 with
the
let command.
Table 2-2. Arithmetical Operators
Operation Symbol
Addition +
Subtraction -
Multiplication *
Division /
Exponent **
Remainder %
Table 2-3. Logical Operators
Operation Symbol Definition
1’s complement ~ Bit negation operator that provides the
bitwise complement of an integer
AND & Arithmetic AND
Inclusive-OR | Arithmetic inclusive OR
Exclusive-OR ^ Arithmetic exclusive OR
Logical shift left << Bit-shift to the left, far-right bit set to zero
Logical shift right >> Bit-shift to the right, far-left bit set to zero
Commenti su questo manuale