We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bab2826 commit 070be29Copy full SHA for 070be29
1 file changed
casestatement.sh
@@ -0,0 +1,29 @@
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 #
0 commit comments