Linux Bash Scripting Tutorial


Arithmetic Operations

Arithmetic expressions
---------------------------------
Arithmetic expansion provides powerful tool for performing(integer) arithmetic operations in scripts. translating string into numerical exansion is relatively straightforward using backqotes, double parenthesis or let
shell interprets the words sourrounded by $ (( )) as arithmetic expression

declare -i  ss

let  command

sp@localhost ~> a=10
sp@localhost ~> b=20
sp@localhost ~> c=$((a+b))
sp@localhost ~> echo $c
30
sp@localhost ~> c=a+b
sp@localhost ~> echo $c
a+b

ADS