迴圈中斷
打破多個迴圈:
arr=(a b c d e f)
for i in "${arr[@]}";do
echo "$i"
for j in "${arr[@]}";do
echo "$j"
break 2
done
done
輸出:
a
a
打破單迴圈:
arr=(a b c d e f)
for i in "${arr[@]}";do
echo "$i"
for j in "${arr[@]}";do
echo "$j"
break
done
done
輸出:
a
a
b
a
c
a
d
a
e
a
f
a