Add UntilDoDone.sh

This commit is contained in:
gitea committed 2026-10-09 08:01:19 +02:00
1 parent 8f7f16abe6
commit cca70e95c2
1 file changed
+26
+26
View File
@@ -0,0 +1,26 @@
# Boucles sur saisies : nombre à trouver
a_trouver=$((($RANDOM%10)+1))
Essais=3
# echo "$a_trouver"
echo -e "Saisir un nombre entre 1 et 10 : \c"
read Nombre
until [ "$Nombre" -eq "$a_trouver" ]
do
if [ "$Nombre" -lt "$a_trouver" ]
then
echo "trop petit !"
else
echo "trop GRAND !"
fi
Essais=`expr $Essais - 1`
if [ $Essais -eq 0 ]
then
echo "PERDU ! Le nombre a trouver etait : $a_trouver :("
exit 1
fi
echo "Il vous reste $Essais essais.."
echo -e "Saisir un nombre entre 1 et 10 : \c"
read Nombre
done
echo "BRAVO !"
exit 0