mirror of https://github.com/01-edu/public.git
Make it work with non-executable scripts
This commit is contained in:
parent
d7e724d52e
commit
dd0b515691
|
@ -8,8 +8,8 @@ IFS='
|
|||
script_dirS=$(cd -P "$(dirname "$BASH_SOURCE")" &>/dev/null && pwd)
|
||||
|
||||
challenge() {
|
||||
submitted=$(cd "$1" && "$script_dirS"/student/mastertheLS)
|
||||
expected=$(cd "$1" && "$script_dirS"/solutions/mastertheLS)
|
||||
submitted=$(cd "$1" && bash "$script_dirS"/student/mastertheLS)
|
||||
expected=$(cd "$1" && bash "$script_dirS"/solutions/mastertheLS)
|
||||
|
||||
diff <(echo "$submitted") <(echo "$expected")
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@ IFS='
|
|||
script_dirS=$(cd -P "$(dirname "$BASH_SOURCE")" &>/dev/null && pwd)
|
||||
|
||||
challenge() {
|
||||
submitted=$(cd "$1" && "$script_dirS"/student/look)
|
||||
expected=$(cd "$1" && "$script_dirS"/solutions/look)
|
||||
submitted=$(cd "$1" && bash "$script_dirS"/student/look)
|
||||
expected=$(cd "$1" && bash "$script_dirS"/solutions/look)
|
||||
|
||||
diff <(echo "$submitted") <(echo "$expected")
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@ echo insecure >> ~/.curlrc
|
|||
caddy start &>/dev/null
|
||||
|
||||
challenge() {
|
||||
submitted=$(./student/myfamily.sh)
|
||||
expected=$(./solutions/myfamily.sh)
|
||||
submitted=$(bash student/myfamily.sh)
|
||||
expected=$(bash solutions/myfamily.sh)
|
||||
|
||||
diff <(echo "$submitted") <(echo "$expected")
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@ IFS='
|
|||
script_dirS=$(cd -P "$(dirname "$BASH_SOURCE")" &>/dev/null && pwd)
|
||||
|
||||
challenge() {
|
||||
submitted=$(cd "$1" && "$script_dirS"/student/lookagain.sh)
|
||||
expected=$(cd "$1" && "$script_dirS"/solutions/lookagain.sh)
|
||||
submitted=$(cd "$1" && bash "$script_dirS"/student/lookagain.sh)
|
||||
expected=$(cd "$1" && bash "$script_dirS"/solutions/lookagain.sh)
|
||||
|
||||
diff <(echo "$submitted") <(echo "$expected")
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@ IFS='
|
|||
script_dirS=$(cd -P "$(dirname "$BASH_SOURCE")" &>/dev/null && pwd)
|
||||
|
||||
challenge() {
|
||||
submitted=$(cd "$1" && "$script_dirS"/student/countfiles.sh)
|
||||
expected=$(cd "$1" && "$script_dirS"/solutions/countfiles.sh)
|
||||
submitted=$(cd "$1" && bash "$script_dirS"/student/countfiles.sh)
|
||||
expected=$(cd "$1" && bash "$script_dirS"/solutions/countfiles.sh)
|
||||
|
||||
diff <(echo "$submitted") <(echo "$expected")
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ IFS='
|
|||
|
||||
cd cl-camp8
|
||||
|
||||
submitted=$(../student/skip.sh)
|
||||
expected=$(../solutions/skip.sh)
|
||||
submitted=$(bash ../student/skip.sh)
|
||||
expected=$(bash ../solutions/skip.sh)
|
||||
|
||||
diff <(echo "$submitted") <(echo "$expected")
|
||||
|
|
|
@ -5,8 +5,8 @@ set -euo pipefail
|
|||
IFS='
|
||||
'
|
||||
|
||||
submitted=$(student/explain.sh)
|
||||
expected=$(solutions/explain.sh)
|
||||
submitted=$(bash student/explain.sh)
|
||||
expected=$(bash solutions/explain.sh)
|
||||
|
||||
if ! diff -q <(echo "$submitted") <(echo "$expected") &>/dev/null; then
|
||||
echo "Wrong answer, detective."
|
||||
|
|
|
@ -5,8 +5,8 @@ set -euo pipefail
|
|||
IFS='
|
||||
'
|
||||
|
||||
submitted=$(student/my_answer.sh)
|
||||
expected=$(solutions/my_answer.sh)
|
||||
submitted=$(bash student/my_answer.sh)
|
||||
expected=$(bash solutions/my_answer.sh)
|
||||
|
||||
if ! diff -q <(echo "$submitted") <(echo "$expected") &>/dev/null; then
|
||||
echo "Wrong answer, detective."
|
||||
|
|
|
@ -7,10 +7,9 @@ IFS='
|
|||
|
||||
script_dirS=$(cd -P "$(dirname "$BASH_SOURCE")" &>/dev/null && pwd)
|
||||
|
||||
|
||||
challenge() {
|
||||
submitted=$(cd "$1" && "$script_dirS"/student/teacher.sh) || (echo "Your script exited with a non-zero status code"; exit 1)
|
||||
expected=$(cd "$1" && "$script_dirS"/solutions/teacher.sh)
|
||||
submitted=$(cd "$1" && bash "$script_dirS"/student/teacher.sh) || (echo "Your script exited with a non-zero status code"; exit 1)
|
||||
expected=$(cd "$1" && bash "$script_dirS"/solutions/teacher.sh)
|
||||
|
||||
if ! diff -q <(echo "$submitted") <(echo "$expected") &>/dev/null; then
|
||||
echo "??? What ?? Wrong answer, teacher. Did you really do the job previously? Or was is just an \"echo\" of luck??"
|
||||
|
|
Loading…
Reference in New Issue