Faire des qcm simplement - retour accueil
git clone git://bebou.netlib.re/qcm
Log | Files | Refs | README |
commit 555c80bd4377eca90fdcb1227ce418d80f4b5259 parent 6cf47f31126b81fcaabb67dca65c095e9b386983 Auteurice: Arthur Pons <arthur.pons@unistra.fr> Date: Wed, 20 Nov 2024 15:20:32 +0100 Séparation de stdout et stderr Sinon on pouvait pas piper l'un dans l'autre, c'est gênant Maintenant writeqcm | qcm fonctionne Diffstat:
M | writeqcm.sh | | | 20 | ++++++++++---------- |
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/writeqcm.sh b/writeqcm.sh @@ -8,19 +8,19 @@ writequestion() { echo "type: $t" >> $1 [ -n "$o" ] && echo "options: $o" >> $1 [ -n "$c" ] && echo "choix: $c" >> $1 - echo "$r" && echo "unique: $r" >> $1 + echo "unique: $r" >> $1 + echo "demander\n" >> $1 } confirmquestion() { - echo "La question : \n" - cat $tmp - echo + echo "La question : \n" >&2 + cat $tmp 1>&2 conf=$(echo "oui\nnon" | gum choose --header="Cette question est correcte ?") } addquestion() { - echo >> $res - cat $res + echo "Le questionnaire complet : \n" >&2 + cat $res 1>&2 fin=$(echo "oui\nnon" | gum choose --header="Ajouter une question ?") } @@ -55,20 +55,20 @@ gatherquestion() { --selected=$r) } -command -V gum 2> /dev/null || { echo "Il faut gum";exit 1; } +command -V gum >&2 /dev/null || { echo "Il faut gum";exit 1; } while [ "$fin" != "non" ];do conf=;q=;t=;c=;o=;r=; while [ "$conf" != "oui" ];do cat /dev/null > $tmp - clear + clear >&2 gatherquestion writequestion $tmp - clear + clear >&2 confirmquestion done writequestion $res - clear + clear >&2 addquestion done