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
Back to Table of Contents
Disclaimer
- License under
CC BY-NC 4.0
- Copyright issue feedback
me#imzye.com
, replace # with @ - Not all the commands and scripts are tested in production environment, use at your own risk
- No personal information is collected.
Feedback