broken do while loop
i can not figure out why my program does not terminate if i type n when i read loop unless it is the last if statement in my program ?
while [ "$loop" = y ] ; do echo "what does baket mean: " ; read word if [ "$word" = why ] then echo "Good job!" else echo "Not correct" echo "Do you want to continue (y) (n)" ; read loop fi clear echo "what does araw araw mean: " ; read word if [ "$word" = daily ] then echo "Good job!" else echo "Not correct" fi echo "Do you want to continue (y) (n)" ; read loop clear echo "what does maganda mean: " ; read word if [ "$word" = pretty ] then echo "Good job!" else echo "Not correct" fi echo "Do you want to continue (y) (n)" ; read loop clear done |
HI,
I thnk your condition check is done once on last,so only it is staying in loop till last condition |
Maybe you need to follow your code closer. The while loop will process all intermediate steps until it hits one of the following (in general):
break continue exit As none of these words appear prior to the closing done for the while loop then the only time your response is read is after the done statement. |
thats a big 10 4
|
All times are GMT -5. The time now is 01:31 AM. |