In Shell Scripting, Mathematical Calculations can be done by using expr Command. See the Example below.
$expr operand1 mathematical_operation operand2
Example
$ expr 3 + 2 $ expr 10 - 2 $ expr 9%2 $ expr 10 \* 3 #multiplication of 10 and 3
If you print output of a Mathematical Calculation, Use ` (tilde ~) Key before and after the Mathematical Expression. See the Example Below.
Example
$ echo `expr 6 + 3`
That's All For Today !
0 comments:
Post a Comment
Ask anything about this Tutorial.