Skip to content

Commit 03afc2d

Browse files
committed
fix: update scoring script
1 parent c82d0a9 commit 03afc2d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Lab6/validate.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,20 @@ cp $solution_path/ans .
1313
cp $solution_path/chal .
1414
cp $solution_path/*.txt .
1515

16+
if [ "$1" -eq 1 ]; then
17+
if grep -q "[^a-zA-Z0-9]" 1.txt; then
18+
echo "[!] 1.txt contains non-alphanumeric characters."
19+
exit 1
20+
fi
21+
fi
22+
23+
if [ "$1" -eq 2 ]; then
24+
if ! grep -q "[^[:print:]]" 2.txt; then
25+
echo "[!] 2.txt must contain at least one non-printable character."
26+
exit 1
27+
fi
28+
fi
29+
1630
make run$1 > out
1731
result=$(diff --strip-trailing-cr ans out)
1832
if [[ -n $result ]]; then

0 commit comments

Comments
 (0)