47 lines
1.0 KiB
Bash
Executable File
47 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# Modified: 23/12/2022
|
|
# P Anelli"
|
|
# Session 4
|
|
|
|
source ${LIBSH}/libeval.sh
|
|
|
|
#-----------------------------------------
|
|
challenge="C22Q1"
|
|
rep=~/Sequence2/A22/c221
|
|
file=/tmp/c221.txt
|
|
#-----------------------------------------
|
|
# Debut
|
|
banniere $challenge
|
|
readline
|
|
|
|
# 1 Bon repertoire
|
|
[ "$rep" == $(pwd) ]
|
|
step $(vraifaux $?) "Le repertoire courant est $rep" true
|
|
|
|
# 2
|
|
[ -n "$line" ]
|
|
step $(vraifaux $?) "Votre commande est non vide: " true
|
|
|
|
# 3
|
|
eval "$line &>/dev/null"
|
|
step $(vraifaux $?) "Votre commande fonctionne: " true
|
|
|
|
# 4
|
|
eval "$line" 1>|$file
|
|
echo "Pas: 4 Affichage du resultat a evaluer"
|
|
echo "==================== Debut du resultat recu ======================"
|
|
cat $file
|
|
echo "==================== Fin du resultat recu ======================"
|
|
|
|
# 5
|
|
[ "$(cat $file)" == "$(echo *o*r*)" ]
|
|
step $(vraifaux $?) "Votre commande donne le bon resultat: " true
|
|
|
|
#-----------------------------------------
|
|
echo -e "Pas: 6 *** Calcul du code pour le resultat ***\n"
|
|
#-----------------------------------------
|
|
|
|
status "$(cat $file)"
|
|
|
|
exit 0
|