First, the interactive input (please try to avoid using)
read python with input () function input
The read command may define a plurality of variable values at the same time; and the contents of the input space separator default, the value of the input variable value corresponding to a; if too many variables default values, the last value will be given a final variable.
If the default value is too small, the excess will become variable control
How 1.read input:
echo "Please enter a directory."
(We need to cancel echo -n newline)
echo "Please enter a directory"; read variables
Please enter a directory: \ etc
Common parameters:
- -p read -p "Please enter a directory" variable
- -t read -t 5 "Please enter a directory" // define the variable timeout
Script Default:
Two, for the statement cycle
for scenarios statement: When a loop is executed and the function needs to perform different objects (object must be the same data)
format for statement:
for variables in A loop done
List Builder way:
- Direct given a list of strings
- List of integers
- Returns a list of command
- glob mechanisms - file name wildcard mechanism
- Variable references - mass participation
supplement