Article Directory
while loop
Repeat test a certain condition, as long as the condition is established, the loop will be repeated, and the condition will be exited from the loop (the opposite of the until loop)
while 条件测试操作
do
命令序列
done
while loop title
Add users in batches. The
user name starts with stu and is numbered in sequence. A
total of 20 users are added, that is, stu1, stu2, stu3...stu20, and the
initial passwords are all set to 123456. Number
guessing game
Get random integers between 0 and 999 through the variable RANDOM to
prompt users to guess , And record the number of times. If the
guessed number is too large or small, the user will be prompted. If the guess is successful, exit the loop.
Calculate the sum of all integers from 1 to 100 and
filter out the odd and even numbers of all integers from 1 to 100.
Prompt the user to enter an integer less than 100 and calculate The sum of all integers from 1 to this number
Find the even and odd numbers of all integers from 1 to 100, and
detect whether the host in the specified range is communicating, and output the communication host ip to the file host_ip.
Output all available in the /dev directory executable file
Execute the script to enter the user name, if the user exists, the output prompts that the user already exists; if the user does not exist, prompt the user to enter the password, create the user and set up its password