August 16, the main study:
One, for loop
Second, while and until loops
Third, loop control statement continue and break
Iv. Package Basics
Five, RPM package management
One, for loop
1) format
For variable name in list;
Loop body
Done
2) Execution mechanism:
Assigns the element in the list to the "variable name" in turn; The loop body is executed once each assignment; until the elements in the list are exhausted, the loop ends
3) List Generation method:
1. Give the list directly
2. List of integers:
(a) {start: End
(b) $ (SEQ [start [step]] end)
3. command to return a list
$ (COMMAND) such as $ (LS/ETC/PASSWD)
4, using glob wildcard characters, such as: *.sh
5. Variable reference: [email protected],$*
Second, while and until loops
1) While loop
While CONDITION; Do
Loop body
Done
CONDITION: cyclic control conditions; Before entering the cycle, make a judgment; once each loop is judged again; the condition is "true", then a loop is executed until the condition test state is "false" to terminate the loop
Therefore: Condtion generally should have a cyclic control variable, and the value of this variable will be continuously corrected in the loop body
Entry condition: condition is true;
Exit Condition: Condition is false
2) until cycle
Until CONDITION; Do
Loop body
Done
Entry condition: CONDITION is False
Exit Condition: CONDITION is True
Third, loop control statement continue and break
1) Loop control statement continue
Continue [n]: end of the nth layer of the current cycle, and directly into the next round of judgment; the inner layer is the 1th floor.
2) loop control statement break
Break [n]: Early end of the nth layer cycle , the inner layer is the 1th layer
Iv. Software Package Management Basics
1) Software operating environment
Api
This article is from the "Laugh Monkey" blog, please be sure to keep this source http://xiaomonkey.blog.51cto.com/11869371/1839351
Bash script programming loop structure +linux package management (1)