MPE/iX Shell and Utilities Reference Manual, Vol 1
bc(1) MPE/iX Shell and Utilities bc(1)
The next group of operators are all assignment operators. They assign values to objects. An
assignment operation has a value: the value that is being assigned. Therefore you can write
operations like a=1+(b=2). In this operation, the value of the assignment in parentheses is 2
because that is the value assigned to b. Therefore, the value 3 is assigned to a. The possible
assignment operators are:
V=B assigns the value of B to V.
Vˆ=B is equivalent to V=VˆB.
V*=B is equivalent to V=V*B.
V/=B is equivalent to V=V/B.
V%=B is equivalent to V=V%B.
V+=B is equivalent to V=V+B.
V-=B is equivalent to V=V-B.
The following expressions are called relations, and their values can be either true (one) or
false (zero). This version of bc lets you use the relational operators in any expression, not
just in the conditional parts of if, while,orfor statements. These operators work in
exactly the same way as their equivalents in the C language. The result of a relation is zero if
the relation is false and one if the relation is true.
A==B is true if and only if A equals B.
A<=B is true if and only if A is less than or equal to B.
A>=B is true if and only if A is greater than or equal to B.
A!=B is true if and only if A is not equal to B.
A<B is true if and only if A is less than B.
A>B is true if and only if A is greater than B.
A&&B is true if and only if A is true (non-zero) and B is true. If A is not true, the
expression B is never evaluated.
A||B is true if A is true or B is true. If A is true, the expression B is never evaluated.
Commands and Utilities 1-51