forked from lll-jy/cs3245-assign2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CS3245-hw2-check.sh
93 lines (82 loc) · 2.52 KB
/
CS3245-hw2-check.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
# Author: Do Ngoc Duc and Sashankh Chengavalli Kumar
EVAL_FILE="search.py"
BUILD_FILE="index.py"
README="README.txt"
DICTIONARY="dictionary.txt"
POSTINGS="postings.txt"
REQUIRED_FILES=5
echo -e "Initialising CS3245 script..."
echo -e "Setting up..."
mkdir evaluation
submittedFiles=0
echo -e "Set up completed!"
echo -e ""
echo -n "Enter zip file (A0123456X.zip) > "
read zipfile
echo -e "Processing zipfile..."
studentNumber="$(basename "${zipfile%.*}")"
if unzip -B $zipfile -d evaluation/$studentNumber/; then
echo -e ""
# Check for submisison files
echo -e "Finding $README, $DICTIONARY, $POSTINGS, $BUILD_FILE, $EVAL_FILE"
path=evaluation/$studentNumber/$studentNumber
echo -e "\t Attempting to find in $path"
if [ ! -d $path ]
then
altpath=evaluation/$studentNumber
echo -e "\t $path does not exist, re-attempting in $altpath"
path=$altpath
fi
# Checking for README.txt
if [ -f $path/$README ]
then
let "submittedFiles=submittedFiles+1"
echo -e "\t\t Found $README"
else
echo -e "\t\t Unable to find $studentNumber's $README"
fi
# Checking for dictionary.txt
if [ -f $path/$DICTIONARY ]
then
let "submittedFiles=submittedFiles+1"
echo -e "\t\t Found $DICTIONARY"
else
echo -e "\t\t Unable to find $studentNumber's $DICTIONARY"
fi
# Checking for postings.txt
if [ -f $path/$POSTINGS ]
then
let "submittedFiles=submittedFiles+1"
echo -e "\t\t Found $POSTINGS"
else
echo -e "\t\t Unable to find $studentNumber's $POSTINGS"
fi
# Checking if BUILD_file exists
if [ -f $path/$BUILD_FILE ]
then
let "submittedFiles=submittedFiles+1"
echo -e "\t\t Found $BUILD_FILE"
else
echo -e "\t\t Unable to find $studentNumber's $BUILD_FILE"
fi
#Checking if EVAL_file exists
if [ -f $path/$EVAL_FILE ]
then
let "submittedFiles=submittedFiles+1"
echo -e "\t\t Found $EVAL_FILE"
else
echo -e "\t\t Unable to find $studentNumber's $EVAL_FILE"
fi
else
echo -e "Please enter the correct zipfile!"
fi
echo -e "Cleaning up ..."
rm -rf evaluation
echo -e "Clean up completed!"
echo -e ""
echo -e "Number of files submitted = $submittedFiles/$REQUIRED_FILES"
if [ "$submittedFiles" -eq "$REQUIRED_FILES" ]; then
echo -e "You have submitted all files.\nPlease proceed on to submit to LumiNUS."
else
echo -e "You have not submitted all the required files.\nPlease double check the required missing files"
fi