URDINESH: SHELL SCRIPT FOR OPERATORS
Showing posts with label SHELL SCRIPT FOR OPERATORS. Show all posts
Showing posts with label SHELL SCRIPT FOR OPERATORS. Show all posts

Sunday, July 19, 2015

SHELL SCRIPT FOR OPERATORS

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

Followers