Addition Subtraction Multiplication and Division in BASH

Home > Search
  by

Addition.

#!/bin/bash

x=10
y=2

echo $((x + y))

 

Subtraction.

#!/bin/bash

x=10
y=2

echo $((x - y))

 

Division.

#!/bin/bash

x=10
y=2

echo $((x / y))

 

Multiplication.

#!/bin/bash

x=10
y=2

echo $((x * y))

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments