Guest_imported
New member
- Jan 1, 1970
- 0
I am writing a shell script in which I am using 2 while loops. I want to break out the inner while loop and skip the current iteration of the outer while loop. Here is a pseudo script. Can anyone suggest a solution.
while [ some condition ]
do
statement 1
statement 2
while [ some condition ]
do
if [ some condition ]
then
# I want to goto statement 1
# how to implement this -- should I put
# break but this will
# merely go to statement 3 #' which I dont want to execute. In
# other words, break out of the inner loop and
# skip only the current iteration of the outer loop
#
else
# Skip the current iteration of the inner # while loop
# I think this can be done by continue isn't # it?..so here goes
continue
fi
done
statement 3
statement 4
done
Any help would be appreciated
while [ some condition ]
do
statement 1
statement 2
while [ some condition ]
do
if [ some condition ]
then
# I want to goto statement 1
# how to implement this -- should I put
# break but this will
# merely go to statement 3 #' which I dont want to execute. In
# other words, break out of the inner loop and
# skip only the current iteration of the outer loop
#
else
# Skip the current iteration of the inner # while loop
# I think this can be done by continue isn't # it?..so here goes
continue
fi
done
statement 3
statement 4
done
Any help would be appreciated