Published on March 16, 2017 by ProgrammingKnowledge

For more detailed Tutorial visit –

The Arithmetic expression is very important feature for performing number arithmetic operations in scripts.
By default variables are treated as strings in bash scripts.
But parsing a string to numbers is very easy using double parentheses and external command such as expr.

Arithmetic operations in Bash Shell
Arithmetic operations can be done on integers using the following methods

$(( expression ))
echo “Addition = $(( number_1 + number_2 ))”

expr — evaluate expression
we can also use expr command to perform Arithmetic operations on numbers.

echo “Addition = $(expr $number_1 + $number_2 )”

My Website –
My Blog –
My Facebook Page –
Google+ –
Twitter –
Pinterest –
Text Case Converter –
Epoch Timestamp Converter –
Decimal – Binary – Hexadecimal Converter –
8-bit Checksum Calculator –

Leave a Reply

2 Comments on "Shell Scripting Tutorial for Beginners 10 – Perform arithmetic operations"

Notify of

trevor zvidza
trevor zvidza
1 year 2 months ago

can l ask you something

1 year 2 months ago

For more detailed Tutorial visit –