In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
The break command allows you to jump out of all loops (terminate the execution of all subsequent loops)
#! / bin/bash
While:
Do
Echo-n "enter a number between 1 and 5:"
Read aNum
Case $aNum in
1 | 2 | 3 | 4 | 5) echo "the number you entered is $aNum!"
*) echo "the number you entered is not between 1 and 5! game over"
Break
Esac
Done
Break instance 2
#! / bin/bash
I, 1
For day in mon tue wed thu fri
Do
Echo "Weeking $((iTunes +)): $day"
If [$I-eq 3]; then
Break
Fi
Done
Execution result
[root@zabbix shell] # sh break.sh
Weeking 1: mon
Weeking 2: tue
The continue command is similar to the break command, except that it does not jump out of all loops, just out of the current loop.
Modify the above example:
#! / bin/bash
While:
Do
Echo-n "enter a number between 1 and 5:"
Read aNum
Case $aNum in
1 | 2 | 3 | 4 | 5) echo "the number you entered is $aNum!"
*) echo "the number you entered is not between 1 and 5!"
Continue
Echo "Game over"
Esac
Done
Contibue instance 2
#! / bin/bash
I, 1
For day in mon tue wed thu fri sat sun
Do
Echo-n "Day $((iTunes +)): $day"
If [$I-eq 7-o $I-eq 8]; then
Echo "(WEEKEND)"
Continue
Fi
Echo "(weekday)"
Done
Execution result
[root@zabbix shell] # sh break.sh
Day 1: mon (weekday)
Day 2: tue (weekday)
Day 3: wed (weekday)
Day 4: thu (weekday)
Day 5: fri (weekday)
Day 6: sat (WEEKEND)
Day 7: sun (WEEKEND)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.