Code for Prepare a menu driven calculator in Unix / Linux / Ubuntu
count=0
while [ $count -eq 0 ]
do
tput clear
echo "1. Addition"
echo "2. Subtracation"
echo "3. Multiplication"
echo "4. Division"
echo "5. Exit"
echo "Enter your choice"
read choice
if [ $choice -eq 1 ]
then
echo "Enter first no "
read first
echo "Enter second no "
read second
echo `echo $first + $second | bc`
elif [ $choice -eq 2 ]
then
echo "Enter first no "
read first
echo "Enter second no "
read second
echo `echo $first - $second | bc`
elif [ $choice -eq 3 ]
then
echo "Enter first no "
read first
echo "Enter second no "
read second
echo `echo $first \* $second | bc`
elif [ $choice -eq 4 ]
then
echo "Enter first no "
read first
echo "Enter second no "
read second
echo `echo $first / $second | bc`
else
count=1
exit
fi
echo "Do you continue (1 for y/ 0 for n) "
read ch
if [ $ch -eq 1 ]
then
count=0
else
exit
fi
done