47 lines
869 B
Bash
Executable File
47 lines
869 B
Bash
Executable File
#!/bin/bash
|
|
# Modified: 11/03/2020
|
|
# P Anelli"
|
|
# Session 3
|
|
|
|
source ${LIBSH}/libeval.sh
|
|
|
|
#-------------------
|
|
challenge=C23Q1
|
|
#------------------
|
|
# Debut
|
|
banniere $challenge
|
|
readline
|
|
|
|
# 1
|
|
[ -n "$line" ]
|
|
step $(vraifaux $?) "Votre commande est non vide: " true
|
|
|
|
#2
|
|
touch "liste de noel.txt"
|
|
eval "$line" 2>|/tmp/error.txt
|
|
step $(vraifaux $?) "Votre commande fonctionne: " true
|
|
|
|
#3
|
|
[ ! -f 'liste de noel.txt' ]
|
|
step $(vraifaux $?) "Le fichier est supprime: " true
|
|
|
|
# 4
|
|
[ $(echo "$line" | grep -c '"') -eq 0 ]
|
|
step $(vraifaux $?) "Votre commande est sans double quote: " false
|
|
|
|
# 5
|
|
[ $(echo "$line" | grep -c "'") -eq 0 ]
|
|
step $(vraifaux $?) "Votre commande est sans simple quote: " false
|
|
|
|
# 6
|
|
echo "$line" | grep -v "\*" >/dev/null
|
|
step $(vraifaux $?) "Votre commande est sans * : " false
|
|
|
|
|
|
#---------------
|
|
# Fin
|
|
status "${challenge}_$res"
|
|
touch liste
|
|
exit 0
|
|
|