Arithmetic Operations
Learn how arithmetic operations work in Bash.
We'll cover the following...
Arithmetic operations
Let’s start with the arithmetic operations since they are relatively simplest. Programming languages use regular symbols to denote them:
+
addition-
subtraction/
division*
multiplication
There are two more operations that are often used in programming. These are exponentiation and division with remainder.
Let’s suppose that we want to raise the number a
to the power of b
. We can write it as a​b​​. Here, a
is the base and b
is the exponent. If we want to raise two to the power of seven, we write 2​7​​. The same operation in Bash looks like this:
Access this course and 1400+ top-rated courses and projects.