-
Notifications
You must be signed in to change notification settings - Fork 8
/
grader.sh
executable file
·161 lines (131 loc) · 3.37 KB
/
grader.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#!/usr/bin/env bash
clear
echo -e "\e[1;34mWelcome the CS 193 Homework 2 Grader!\e[0m"
source ~/.bashrc
POINTS=0
./clean.sh
echo "ORIGIN Directory Reset"
OUTPUT=$(./answers.sh)
echo "Running answers.sh"
# Task 1
echo -e "\n\e[1;34mTask 1\e[0m"
FILE=ORIGIN/Homework/MA165/HW1.txt
if test -f "$FILE"; then
echo -e "\e[92m$FILE exists: +1 points\e[0m"
((POINTS=$POINTS + 1))
else
echo -e "\e[91m$FILE does not exist\e[0m"
fi
# Task 2
echo -e "\n\e[1;34mTask 2\e[0m"
FILE=ORIGIN/Memes/SpongeBob/money.jpeg
if test -f "$FILE"; then
echo -e "\e[91m$FILE exists\e[0m"
else
echo -e "\e[92m$FILE does not exist: +1 points\e[0m"
((POINTS=$POINTS + 1))
fi
# Task 3
echo -e "\n\e[1;34mTask 3\e[0m"
FILE=ORIGIN/Memes/SpongeBob/fafsa.jpg
if test -f "$FILE"; then
echo -e "\e[92m$FILE exists: +1 points\e[0m"
((POINTS=$POINTS + 1))
else
echo -e "\e[91m$FILE does not exist\e[0m"
fi
# Task 4
echo -e "\n\e[1;34mTask 4\e[0m"
FILE=ORIGIN/Homework/CS191
if test -d "$FILE"; then
echo -e "\e[91m$FILE exists\e[0m"
else
echo -e "\e[92m$FILE does not exist: +1 points\e[0m"
((POINTS=$POINTS + 1))
fi
# Task 5
echo -e "\n\e[1;34mTask 5\e[0m"
FILE=ORIGIN/Programs/C++
if test -d "$FILE"; then
echo -e "\e[92m$FILE exists: +2 points\e[0m"
((POINTS=$POINTS + 2))
else
echo -e "\e[91m$FILE does not exist\e[0m"
fi
# Task 6
echo -e "\n\e[1;34mTask 6\e[0m"
FILE=ORIGIN/Programs/C++/Age.cpp
if test -f "$FILE"; then
echo -e "\e[92m$FILE exists: +2 points\e[0m"
((POINTS=$POINTS + 2))
else
echo -e "\e[91m$FILE does not exist\e[0m"
fi
# Task 7
echo -e "\n\e[1;34mTask 7\e[0m"
FILE=ORIGIN/Homework/CS180/Project_1
if test -d "$FILE"; then
echo -e "\e[92m$FILE exists: +2 points\e[0m"
((POINTS=$POINTS + 2))
else
echo -e "\e[91m$FILE does not exist\e[0m"
fi
# Task 8
echo -e "\n\e[1;34mTask 8\e[0m"
FILE=ORIGIN/Programs/C/Count.c
if test -f "$FILE"; then
echo -e "\e[92m$FILE exists: +1 points\e[0m"
((POINTS=$POINTS + 1))
else
echo -e "\e[91m$FILE does not exist\e[0m"
fi
FILE=ORIGIN/Programs/C/Goodbye.c
if test -f "$FILE"; then
echo -e "\e[92m$FILE exists: +1 points\e[0m"
((POINTS=$POINTS + 1))
else
echo -e "\e[91m$FILE does not exist\e[0m"
fi
# Task 9
echo -e "\n\e[1;34mTask 9\e[0m"
FILE="ORIGIN/Programs/Python 3/Name.py"
if test -f "$FILE"; then
echo -e "\e[92m$FILE exists: +1 points\e[0m"
((POINTS=$POINTS + 1))
else
echo -e "\e[91m$FILE does not exist\e[0m"
fi
FILE="ORIGIN/Programs/Python 3/Space.py"
if test -f "$FILE"; then
echo -e "\e[92m$FILE exists: +1 points\e[0m"
((POINTS=$POINTS + 1))
else
echo -e "\e[91m$FILE does not exist\e[0m"
fi
# Task 10
echo -e "\n\e[1;34mTask 10\e[0m"
FILE=ORIGIN/Homework/POL141/Essay.txt
if test -f "$FILE"; then
echo -e "\e[92m$FILE exists: +2 points\e[0m"
((POINTS=$POINTS + 2))
else
echo -e "\e[91m$FILE does not exist\e[0m"
fi
# Task 11
echo -e "\n\e[1;34mTask 11\e[0m"
FILES=$(ls)
if [ "$FILES" = "$OUTPUT" ]; then
echo -e "\e[92mCommand correct: +2 points\e[0m"
((POINTS=$POINTS + 2))
else
echo -e "\e[91mCommand incorrect\e[0m"
fi
# Task 12
echo -e "\n\e[1;34mTask 12\e[0m"
if [ "$(alias wttr)" = "alias wttr='curl wttr.in'" ] ; then
echo -e "\e[92mAlias correct: +2 points\e[0m"
((POINTS=$POINTS + 2))
else
echo -e "\e[91mAlias incorrect\e[0m"
fi
echo -e "\e[92mFinal Score: $POINTS/20\e[0m"