To do math operations in shell use "expr", syntax is as follows
Syntax: expr op1 operator op2
Syntax: expr op1 operator op2
Where, op1 and op2 are any Integer Number (Number without decimal point) and operator can be:
+ Addition
- Subtraction
/ Division
% Modular, to find remainder For e.g. 20 / 3 = 6 , to find remainder 20 % 3 = 2, (Remember its integer calculation)
\* Multiplication (注意要有反斜线)
Note:
space is required between number and operator