File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ # Purpose: Example for Case Statement
3
+ # Version:1.0
4
+ # WebSite: https://arkit.co.in
5
+ # Created Date: Mon May 21 20:37:59 IST 2018
6
+ # Modified Date:
7
+ # Author: Ankam Ravi Kumar
8
+ # START #
9
+ echo -c " Enter a number: \c"
10
+ read -r a
11
+ echo -c " Enter b number: \c"
12
+ read -r b
13
+
14
+ echo " 1. Sum of values"
15
+ echo " 2. Substraction"
16
+ echo " 3. Multiplication"
17
+ echo " 4. Division"
18
+ echo " 5. Modulo division"
19
+ echo -c " Enter Your Choice from above menu: \c"
20
+ read -r ch
21
+ case $ch in
22
+ 1) echo " Sum of $a + $b = " ` expr $a + $b ` ;;
23
+ 2) echo " Subsctraction = " ` expr $a - $b ` ;;
24
+ 3) echo " Multiplication = " ` expr $a \* $b ` ;;
25
+ 4) echo " Division = " ` expr $a / $b ` ;;
26
+ 5) echo " Modulo Division = " ` expr $a % $b ` ;;
27
+ * ) echo " Invalid Option provided"
28
+ esac
29
+ # END #
You can’t perform that action at this time.
0 commit comments