Rather than trying to extend the syntax of the shell to do
start:
for ...; do
for ...; do
...
done
done
if CONDITION; then
goto start
else
SOMETHING
fi
you may do
while true; do
for ...; do
for ...; do
...
done
done
if ! CONDITION; then
SOMETHING
break
fi
done
or
while true; do
for ...; do
for ...; do
...
done
done
if ! CONDITION; then
break
fi
done
SOMETHING
UPDATE: New code in question:
start:
while true; do
for ...; do
for ...; do
if ...; then
break 99
fi
...
done
done
done
...
if CONDITION; then
SOMETHING
goto start
else
SOMETHING_ELSE
fi
for ...; do
...
done
To avoid a goto, this may be transformed into
while true; do
while true; do
for ...; do
for ...; do
if ...; then
break 99 # change to one less than
# the total depth, to not exit
# outermost loop
fi
...
done
done
done
...
if ! CONDITION; then
break
fi
SOMETHING
done
SOMETHING_ELSE
for ...; do
...
done
9
solved What could be the substitute to handle the flow control of go-to in SHELL script [duplicate]