I am trying loop control. while loop then a for loop and inside it there are couple of if loops, if 3 of the if loop satisfies it should exit the for loop to continue with while loop else it should exit the if loop to continue rest of for loop iterations
LIMIT=100
while [ "count" -le "$LIMIT" ]
do
for i in 1 2 3 4 5
do
var a
var b
var c
var d
if [ $d -eq 1 ] && [ $a == Done ] && [ $b -eq 0 ]
then
echo "$c" | tr '\n' '\t'
echo "Successful"
break 2 # Need to exit entire for loop
elif [ $d -eq 0 ] && [ $a == Done ] && [ $b -eq 0 ]
then
break # Need to go to next iteration of for
elif [ $a == Active ]
then
echo "Active" # Need to exit entire for loop
break 2
elif [ $d -eq 1 ] && [ $a == Done ] && [ $b -gt 0 ]
then
echo "Fail" # Need to exit entire for loop
break 2
elif [ $a == Queued ]
then
echo "Queued" # Need to exit entire for loop
break 2
else
echo "Nothing"
fi
done
done
For some reason it exits everything when first if loop is true.