While loop statement
While Loop statement while Loop statement, you can execute a sequence of commands repeatedly according to a specific condition until the condition is no longer satisfied. In the application of scripts, endless loops should be avoided, otherwise subsequent command operations will not be executed. One difference between for and while: for loop statements are very useful in situations where list objects are irregular and the source of the list is fixed (such as a list file). However, when it is required to control the number of cycles, operands are numbered in numerical order, and repeated operations are performed according to specific conditions, it is more suitable to use while loop statements.
The flow of while loop statement: first, judge the while conditional test operation result, if the condition is true, execute the command sequence in the do...done loop body; return while to judge the conditional test result, if the condition is still true, continue to execute the loop body; after returning while again, judge the conditional test result. Such a loop does not jump to the end of the done loop until the conditional test results after while are not valid.