bash continue
########### continue #########
continue [n]
The [n] argument is optional and can be greater than or equal to 1.
When [n] is given, the n-th enclosing loop is resumed.
continue 1 is equivalent to continue.
# eg 1 ############ ######
i=0
while [[ $i -lt 5 ]]; do
((i++))
if [[ "$i" == '2' ]]; then
continue
fi
echo "Number: $i"
done
echo 'All Done!'
OP :
Number: 1
Number: 3
Number: 4
Number: 5
All Done!
# eq 2 ############
for i in {1..50}; do
if [[ $(( $i % 9 )) -ne 0 ]]; then
continue
fi
echo "Divisible by 9: $i"
done
OUTPUT :
Divisible by 9: 9
Divisible by 9: 18
Divisible by 9: 27
Divisible by 9: 36
Divisible by 9: 45
https://linuxize.com/post/bash-break-continue/