Shell Scripting Tutorial – 4

Hello,

Now, lets perform arithmetic operation using Bash Shell Scripting . I am using `let` which allows us

Now, you can perform operation like

value++ = Increments by 1

value– = Decrements by 1

value = x + y -> Addition

Similarly, all other operations. But in multiplication you need to use \* for escaping 🙂

Code:

#!/bin/bash

let “a = 10 + 20”
echo $a

let a–
echo $a

let “a = 5 * 4”
echo $a

let “a = $1 + 30”
echo $a

Leave a comment