exit loop bash
# [n] is an optional argument and must be greater than or equal to 1.
# When [n] is provided, the n-th enclosing loop is exited. break 1 is equivalent to break.
break [n]
# an example
i=0
while [[ $i -lt 5 ]]
do
echo "Number: $i"
((i++))
if [[ $i -eq 2 ]]; then
break
fi
done
echo 'All Done!'