-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbig3.sh
More file actions
39 lines (27 loc) · 685 Bytes
/
big3.sh
File metadata and controls
39 lines (27 loc) · 685 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
34
35
36
37
38
39
#!/bin/bash
n1=$1
n2=$2
n3=$3
if [ $# -ne 3 ]
then
echo "Error!! The script requires three arguments!! Enter three arguments next time."
exit 1
fi
if [[ $n1 =~ ^-?[0-9]+$ ]] && [[ $n2 =~ ^-?[0-9]+$ ]] && [[ $n3 = ~^-?[0-9]+$ ]]
then
if [[ $n1 -eq $n2 ]] && [[ $n2 -eq $n3 ]]
then
echo "The Three numbers are Equal"
elif [[ $n1 -gt $n2 ]] && [[ $n2 -gt $n3 ]]
then
echo "$n1 is the grestest of three numbers"
elif [[ $n2 -gt $n1 ]] && [[ $n2 -gt $n3 ]]
then
echo "$n2 is the grestest of three numbers"
else
echo "$n3 is the grestest of three numbers"
fi
else
echo "Error!! The script requires integer arguments!! Enter three integers next time."
exit 1
fi