2021-2022/tools/scripts/new_eval.sh

67 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 4 \
"1" "2nd" \
"2" "Enseignements Scientifique" \
"3" "4e" \
"4" "Technologique" \
2>&1 1>&3)
exec 3>&-
case $selection in
1 )
tribe="2nd"
;;
2 )
tribe="EnseignementsScientifique"
;;
3 )
tribe="4e"
;;
4 )
tribe="Technologique"
;;
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