Anyone know of a simple way to immediately exit the current iteration of a while/until loop in bash, but continue to the next iteration in the loop?
My basic structure is:
sort -u -r -g -k 5 -t ' ' $filteredtoptrigsf |\
while read -a linA; do
stuff
morestuff
[[ $smthStinks -eq 1 ]] && break
[[ ${linA[*]} == $onlyThisLineStinks ]] && done
lotsaSlowProcessing
doSmthDangerous
done
In the first [[ ... ]] test I definitely want break out of the while loop and never come back, due to some calculated conditions.
In the second [[ ]] test a condition is met that should only break out of the cycle once, avoiding further code below it, but continue reading the next line of input and let while continue.
As you can see I tried done there but that only errors with token unexpected.
I would rather not wrap much of the loop's code inside if's and else's since there are actually quite of few terminating conditions, both global and for current cycle only.