Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 070be29

Browse files
author
Ankam Ravi Kumar
authored
Create casestatement.sh
1 parent bab2826 commit 070be29

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

casestatement.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)