break

从 for, while, until, select 循环中退出

语法

  break [n]

实例

for myloop in 1 2 3 4 5 
do 
   echo -n "$myloop"
   if [ "$myloop" -eq 3 ] 
   then 
   break # This line will break out of the loop
   fi
done

break is a POSIX `special’ builtin

break 命令实例:

Linux的Bash命令行(A-Z排序)