forked from Jagoum/GIS_training
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalcu.sh
More file actions
executable file
·33 lines (32 loc) · 756 Bytes
/
calcu.sh
File metadata and controls
executable file
·33 lines (32 loc) · 756 Bytes
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
#!/bin/bash
welcome() {
echo "********************************** CALCULATOR **********************************"
echo ""
echo ""
echo "To to use this calculator please make sure to source it"
}
usage() {
echo "To add, write add num1 num2"
echo "To subtract, write subtract num1 num2"
echo "To multiply, write multiply num1 num2"
echo "To divide, write divide num1 num2"
echo "To exit pless ctrl + C"
}
add() {
sum=`expr $1 + $2`
echo "sum of $1 and $2 = $sum"
}
subtract() {
diff=`expr $1 - $2`
echo "differrence of $1 and $2 = $diff"
}
multiply() {
mult=`expr $1 \* $2`
echo "Multiple of $1 and $2 = $multi"
}
divide() {
div=`expr $1 / $2`
echo "$1 divided by $2 = $div"
}
welcome
usage