Operator
echo "Enter the Operator"
read a
echo "Name of Operator is: "
case $a in
+) echo "Addition"
;;
-) echo "Subtraction"
;;
\*) echo "Multiplication"
;;
/) echo "Division"
;;
*) echo "Not an Operator"
;;
esac
OUTPUT:
enter the operator
+
name of operator is:
addition
[2k7ca324@localhost ~]$ sh op.sh
enter the operator
-
name of operator is:
subtraction
[2k7ca324@localhost ~]$ sh op.sh
enter the operator
*
name of operator is:
multiplication
[2k7ca324@localhost ~]$ sh op.sh
enter the operator
/
name of operator is:
division
[2k7ca324@localhost ~]$ sh op.sh
enter the operator
%
name of operator is:
not an operator
No comments:
Post a Comment
Thanks for your valuable comments