Arithmetic operation in Bash
1:$(( ))
2:$[ ]
3:expr
C=`expr $A + $B`
4:bc命令
#!/bin/bash
x=1
y=2
echo $(( x + y ))
echo $[ $x + $y ]
echo `expr $x + $y`
let z=$x+$y
echo $z
bc <<< "scale=3; 11/15"
5:let
let C=$A+$B
Disclaimer
- License under
CC BY-NC 4.0
- Copyright issue feedback
me#imzye.me
, replace # with @ - Not all the commands and scripts are tested in production environment, use at your own risk
- No privacy information is collected here