lundi 26 février 2018

Repeat one particular case statement on invalid output condition and loop inside the case

I have a case statement like 1) 2) 3) ... as below where there are multiple if else condition on 1) format case. I want to repeat the particular case on invalid condition. When user select 1 first it ask for the name of the juice. next it asks the availability. If yes it continues else asks for the count and does an operation. If the operation "exit 0" it just prints done. if the operation "exit 1" I wanted the loop to continue from the top ie from "name of the juice?"

1)
echo "Name of the Juice ?"
read juice
echo "Is it available? [Y/N]"
read deci
if [ "$deci" = "N" ]
then
echo "Continue.!"
else
echo "how many left in the warehouse ?"
read left
I have a command here which exits 0 or 1
if [ $? -eq 0 ]; then
echo "done"
else 
<I have to continue from the start [ie;name of the juice]>
fi
fi
;;
echo "Name of the Pizza ?"
read juice
echo "Is it available? [Y/N]"
read deci
if [ "$deci" = "N" ]
then
echo "Continue.!"
else
echo "how many left ?"
read left
I have a command here which exits 0 or 1
if [ $? -eq 0 ]; then
echo "done"
else 
<I have to continue from the start [ie;name of the juice]>
fi
fi
;;

Aucun commentaire:

Enregistrer un commentaire