The example explains the difference between continue break

  

Execute the following shell, you can clearly distinguish the difference between break and 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

Do you try?

Copyright © Windows knowledge All Rights Reserved