#TO PERFORM ARITHMETIC OPERATIONS USING SHELL SCRIPTING IN LINUX
echo "Enter the number 1: "
read x
echo "Enter the number 2: "
read y
exit=0
while [ $exit -eq 0 ]
do
echo -e "\n1.Addition \n2.Subtraction \n3.Multiplication \n4.Division \n5.Mod \nEnter your choice: "
read ch
case $ch in
1)add=`expr $x + $y`
echo "Addition= " $add;;
2)sub=`expr $x - $y`
echo "Subtraction= " $sub;;
3)mul=`expr $x \* $y`
echo "Multiplication= " $mul;;
4)div=`expr $x / $y`
echo "Division= " $div;;
5)mod=`expr $x % $y`
echo "Mod= " $mod;;
esac
echo -e "\nDo you want to continue(0:'YES'/1:'NO'): "
read exit
done
No comments:
Post a Comment