2022-2023/tools/scripts/new_eval.sh

71 lines
1.3 KiB
Bash

#!/bin/bash
display_result() {
dialog --title "$1" \
--no-collapse \
--msgbox "$result" 0 0
}
exec 3>&1
selection=$(dialog \
--backtitle "Création d'une nouvelle évaluation: Classe" \
--title "Menu" \
--clear \
--cancel-label "Exit" \
--menu "Choisir un niveau:" 0 0 5 \
"1" "2nd" \
"2" "SNT" \
"3" "Enseignements Scientifique" \
"4" "Première NSI" \
"5" "Première Technologique" \
2>&1 1>&3)
exec 3>&-
case $selection in
1 )
tribe="2nd"
;;
2 )
tribe="SNT"
;;
3 )
tribe="EnseignementsScientifique"
;;
4 )
tribe="1NSI"
;;
5 )
tribe="1ST"
;;
esac
exec 3>&1
date=$(dialog --calendar "Date" 0 0 2>&1 1>&3 | awk -F "/" '{print $3"-"$2"-"$1}')
exec 3>&-
exec 3>&1
name=$(dialog \
--inputbox "Nom de l'évaluation" \
0 0 \
2>&1 1>&3)
exec 3>&-
exec 3>&1
duration=$(dialog \
--inputbox "Temps pour le travailler" \
0 0 \
2>&1 1>&3)
exec 3>&-
mkdir -p $tribe/Evaluations/
sequence_path=$tribe/Evaluations/DS_${date}/
mkdir -p $sequence_path
export name=$name
export date=$date
export tribe=$tribe
export duration=$duration
envsubst < ./tools/skeleton/eval/exercises.tex > $sequence_path/exercises.tex
envsubst < ./tools/skeleton/eval/sujet.tex > $sequence_path/sujet.tex