qcm

Faire des qcm simplement - retour accueil

git clone git://bebou.netlib.re/qcm
Log | Files | Refs | README |

commit 818111652d96348c3d0c25cee5900dda73552236
parent 8a1ee1bbeaf6a2f9479d10d73ecea9f3bebc91c7
Auteurice: Arthur Pons <arthur.pons@unistra.fr>
Date:   Fri,  8 Nov 2024 17:12:47 +0100

Un tout petit peu de factorisation

Diffstat:
Mqcm.sh | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/qcm.sh b/qcm.sh @@ -54,12 +54,12 @@ demander() { answers=$(cat $tmpd/o | tr -d '\n') case "$type" in - ( "ouverte" ) pattern="GET /$id/";; - ( "regex" ) pattern="GET /$id/${options:-[ABCD] } ";; - ( * ) pattern="GET /$id/[$answers]$choix ";; + ( "ouverte" ) pattern=;; + ( "regex" ) pattern="${options:-[ABCD] } ";; + ( * ) pattern="[$answers]$choix ";; esac - tail -fn0 "$logs" | stdbuf -oL grep -E "$pattern" >> $tmpd/in & + tail -fn0 "$logs" | stdbuf -oL grep -E "GET /$id/$pattern" >> $tmpd/in & tailpid=$! while :;do