-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6f4e536
commit 94d58b3
Showing
2 changed files
with
20 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,24 @@ | ||
#!/bin/bash | ||
|
||
getinput regex1 > student/student_code.sh | ||
tr -d '\r' < student/student_code.sh > student/tmp | ||
mv student/tmp student/student_code.sh | ||
cp ./buggy.sh ./student/buggy.sh | ||
getinput regex1 | tr -d '\r' > student/student_regex1 | ||
getinput regex2 | tr -d '\r' > student/student_regex2 | ||
getinput regex3 | tr -d '\r' > student/student_regex3 | ||
getinput regex4 | tr -d '\r' > student/student_regex4 | ||
cp apache.log student/ | ||
|
||
regex1=$(cat student_regex1) | ||
regex2=$(cat student_regex2) | ||
regex3=$(cat student_regex3) | ||
regex4=$(cat student_regex4) | ||
|
||
if grep -q -E "cd|ls|cat" ./student/student_code.sh; then | ||
feedback-result failed | ||
feedback-msg -em "Vous n'avez pas besoin d'utiliser la commande cd, ls ou cat" | ||
exit 0 | ||
fi | ||
|
||
chmod +x ./student/buggy.sh | ||
cd student | ||
output=$(run_student sh ./student_code.sh) | ||
|
||
if [[ -f "./args_err.txt" ]]; then | ||
feedback-result failed | ||
feedback-msg -em "Attention, le script buggy.sh prend comme argument un nombre entier" | ||
exit 0 | ||
fi | ||
output1=$(grep -oP $regex1 apache.log) | ||
good_output1=$(grep -oP '(\d{1,3}\.){3}\d{1,3}' apache.log) | ||
|
||
if [ "$output" = "42" ]; then | ||
feedback-result success | ||
feedback-msg -em "Bravo, le nombre qui posait problème était bien 42." | ||
if [ $output1==$good_output1 ]; then | ||
feedback-result --id regex1 success | ||
feedback-msg -em "Bravo" | ||
else | ||
feedback-result failed | ||
feedback-msg -em "Résultat de votre programme : $output" | ||
feedback-msg -em "Résultat de votre programme : $output1" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters