首页 > 代码库 > Math operator in a Shell Script

Math operator in a Shell Script

Operators

The shells use arithmetic operators from the C programming language, in decreasing order of precedence.Math Operators

OPERATORDESCRIPTION
++ −− < /editor query >Auto-increment and auto-decrement, both prefix and postfix
+Unary plus
Unary minus
! ~Logical negation; binary inversion (one‘s complement)
* / %Multiplication; division; modulus (remainder)
+ −Addition; subtraction
<< >>Bitwise left shift; bitwise right shift
<= >=Less than or equal to; greater than or equal to
< >Less than; greater than
== !=Equality; inequality (both evaluated left to right)
&Bitwise AND
^Bitwise exclusive OR
|Bitwise OR
&&Logical AND
||Logical OR

Math operator in a Shell Script