Loading static/js/exercises.mjs +8 −2 Original line number Diff line number Diff line Loading @@ -195,7 +195,13 @@ export const pooltest = test("Pooltest Sommersemester 2024", async function () { this.describe(`Lasse dir den Inhalt der Datei "reverse.txt" anzeigen und schreibe den Inhalt in umgekehrter Reihenfolge in eine neue Datei mit dem Namen "correct.txt"`) await this.prepareWith("echo 'amanaP :lanac a ,nalp a ,nam A' >> reverse.txt") await this.prepareWith("echo 'amanaP :lanac a ,nalp a ,nam A' > reverse.txt; "+ // Because "rev" doesn't work in this BusyBox installation, we create a set of scripts to emulate its behavior "rm /bin/rev; "+ "echo 'i=$(( ${#1}-1 )); while [ $i -ge 0 ]; do printf \"${1:i:1}\"; i=$(( $i-1 )); done; echo' > /tmp/revline.sh; "+ "echo 'while true; do read -r userInput; if [ $? != 0 ]; then break; fi; /tmp/revline.sh \"$userInput\"; done' > /tmp/revstdin.sh; "+ "echo 'if [ ! -z $1 ]; then cat \"$1\" | /tmp/revstdin.sh; else /tmp/revstdin.sh; fi' > /bin/rev; "+ "chmod +x /tmp/rev*.sh; chmod +x /bin/rev") await this.manualConfirmation() Loading Loading
static/js/exercises.mjs +8 −2 Original line number Diff line number Diff line Loading @@ -195,7 +195,13 @@ export const pooltest = test("Pooltest Sommersemester 2024", async function () { this.describe(`Lasse dir den Inhalt der Datei "reverse.txt" anzeigen und schreibe den Inhalt in umgekehrter Reihenfolge in eine neue Datei mit dem Namen "correct.txt"`) await this.prepareWith("echo 'amanaP :lanac a ,nalp a ,nam A' >> reverse.txt") await this.prepareWith("echo 'amanaP :lanac a ,nalp a ,nam A' > reverse.txt; "+ // Because "rev" doesn't work in this BusyBox installation, we create a set of scripts to emulate its behavior "rm /bin/rev; "+ "echo 'i=$(( ${#1}-1 )); while [ $i -ge 0 ]; do printf \"${1:i:1}\"; i=$(( $i-1 )); done; echo' > /tmp/revline.sh; "+ "echo 'while true; do read -r userInput; if [ $? != 0 ]; then break; fi; /tmp/revline.sh \"$userInput\"; done' > /tmp/revstdin.sh; "+ "echo 'if [ ! -z $1 ]; then cat \"$1\" | /tmp/revstdin.sh; else /tmp/revstdin.sh; fi' > /bin/rev; "+ "chmod +x /tmp/rev*.sh; chmod +x /bin/rev") await this.manualConfirmation() Loading