-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBonus.script
More file actions
37 lines (32 loc) · 992 Bytes
/
Copy pathBonus.script
File metadata and controls
37 lines (32 loc) · 992 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
#!/bin/bash
clear
echo "
Please input:
#. Three Letter Airport Code
or
#. City, State Name
or
#. "Quit" to Exit
"
invalid_input () {
echo "Invalid input '$REPLY'" >&2
exit 1
}
read -p "Please Input "
if [[ "$REPLY" == Quit ]]; then
echo "Exit."
exit
fi
#this is for the three letter code
if [[ "$REPLY" =~ ^[a-zA-Z]${3} ]]; then
echo -e "The number of delayed flights to or from $REPLY is:"
grep -w "$Reply" /ufrc/zoo6927/share/Class_Files/data/flights.May2017-Apr2018.csv | cut -d "," -f 3,7,13,16,24 | grep GNV | grep 1.00 | wc -l
#For city, state name
elif [[ $REPLY =~ ^[a-zA-Z]\,[a-zA-Z]{2}$ ]]; then
echo -e "The number of delayed flights to or from $REPLY is:"
grep -w /ufrc/zoo6927/share/Class_Files/data/flights.May2017-Apr2018.csv | cut -d "," -f 3,7,13,16,24 | grep GNV | grep 1.00 | wc -l
#invalid input
else
invalid_input >&2
exit
fi