執行下面的shell,就能很明了的區別break和continue的差異了:
[ckl@zhao-test tmp]$ cat test.sh
#!/bin/bash
for index in 1 2 3 4 5 6 7 8 9 10
do
if [ $index -le 3 ] ;
then echo "continue"
continue
fi
echo $index
if [ $index -ge 8 ] ;
then echo "break"
break
fi
done
你試試?