Maths in Bash is not evident for the begginer. As a newbie a long time ago i would try *x=1+1* for example and get frustrated that it does not work. Here are a few examples on how to do some maths in Bash with integers or float:

Basic Integer Math

To tell bash to do integer math for us, we need to use the command expr or let - which means evaluate expression.
https://www.jnvilo.com/static/mycms/editor/close-window-50.png
By using expr

[email protected]:~$ expr 100 + 100
200

And we can capture the output into a variable and do maths with the variable as follows:

[email protected]:~$ var=$(expr 1 + 1) 
[email protected]:~$ var=$(expr $var + 1) 
[email protected]:~$ echo $var
3

By Using the expression let

[email protected]:~$ echo $var
1
[email protected]:~$ let var=1
[email protected]:~$ echo $var
1
[email protected]:~$ let var=$var+1
[email protected]:~$ echo $var
2
[email protected]:~$ let var=$var*2
[email protected]:~$ echo $var
4
[email protected]:~$ let var=$var\/2
[email protected]:~$ echo $var
2
[email protected]:~$

The example shows that in order to do division we need to escape the forward slash.