I am very new to Bash scripting, so please excuse me if the question is somewhat incoherent. I want my script to repeat a question 4 times if the user answers No, if the user answers Yes, then the script can exit, this is what I have so far
#!/bin/bash
echo "Would you like a cup of tea?"
read answer
while true;
do
if [ $answer = Y ] then
echo "Great, I'll make tea now"; then
break
if [ $answer = N ] then
echo "Are you sure?"
continue
if [ $answer = N ] then
echo "Are you sure?"
continue
if [ $answer = N ] then
echo "Are you sure?"
continue
if [ $answer = N ] then
echo "Ok, I give up!"
exit
fi
Any help is much appreciated
Aucun commentaire:
Enregistrer un commentaire