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

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s