Bjr,
Aller pour s'amuser, voilà comment je procéderai :
#/bin/bash
scriptPID=$$
Question() {
Timer &
timerPID=$!
while true
do
echo "Entrez un mot de passe correct : "
read pass
[[ "$pass" == 1 ]] && break
done
kill -9 $timerPID
echo bonne réponse
}
Timer() {
sleep 10 && echo 'timeout !!!' && kill -9 $scriptPID
}
Question
echo 'bye'
exit
Bon, je sais, kill -9 c'est un peu hard, mais bon 😃