Shell Script to make a menu driven calculator using case


 Shell Script to make a menu driven calculator using case



Program :-



# Shell Script to make a menu driven calculator using case.

#!/bin/bash

 

echo "Enter A = "

read a

 

echo "Enter B = "

read b

echo " Enter the Arithmatic logic = "

 

echo  "1. Addition";

echo  "2. subtraction";

echo  "3. Multiplication";

echo  "4. Division";

 

read al

case $al in

1)

echo "Addition is: `expr $a + $b`";;

2)

echo "Subtraction is: `expr $a - $b`";;

3)

echo "Multiplication is: `expr $a \* $b`";;

4)

echo "Division is: `expr $a / $b`";;

*)

echo "Invalid choice" ;

esac

 

 

Output :-