[root@a ~]#cat break.sh
#!/bin/bash
while : #其中“:”表示while循环的条件永远为真的意思
do
read -p "Enter a number [1-5]: " num
case $num in
1|2|3|4|5)
echo "It's OK"
;;
*)
echo "Wrong,bye-bye!"
break
esac
done
[root@a ~]#sh break.sh
Enter a number [1-5]: 3
It's OK
Enter a number [1-5]: 5
It's OK
Enter a number [1-5]:24
Wrong,bye-bye
break中断,跳出指定条件的循环
continue忽略第三次循环
exit符合指定条件,直接退出脚本
批量创建用户和删除用户
为者常成,行者常至
Give me five~!