forked from Devops-Techstack/ShellScripting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cal.sh
36 lines (36 loc) · 1.06 KB
/
cal.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
clear
echo "--------------------------------"
echo "-------welcome to calculator----"
echo "--------------------------------"
echo -e "[a]ddition\n[b]Subtraction\n[c]Multiplication\n[d]Division\n"
read -p "Enter your choice: " choice
case $choice in
[aA])
read -p "Enter first number: " num1
read -p "Enter second number: " num2
result=$((num1+num2))
echo "The result for your choice is: $result"
;;
[bB])
read -p "Enter first number: " num1
read -p "Enter second number: " num2
result=$((num1-num2))
echo "The result for your choice is: $result"
;;
[cC])
read -p "Enter first number: " num1
read -p "Enter second number: " num2
result=$((num1*num2))
echo "The result for your choice is: $result"
;;
[dD])
read -p "Enter first number: " num1
read -p "Enter second number: " num2
result=$((num1/num2))
echo "The result for your choice is: $result"
;;
*)
echo "Wrong choice"
;;
esac