Syntax for the Read command command:
Read [parameter] variable name commonly used parameters are as follows:
-t timeout to set the time-out.
-P Prompt Sets the prompt message, which will appear before the cursor.
Condition test:
The condition test can determine the state of the script running. It is often used for conditional branching so that different commands can be executed in different running states.
[param1 judgment symbol param2]
[Judging symbol param]
File status test:
-B filename Determines whether the file filename is a block device and returns False if the file does not exist.
-c filename Determines whether the file filename is a character device and returns False if the file does not exist.
-D pathname Determines if the path pathname is a directory and returns false if the path does not exist.
-e pathname determine if the path pathname exists.
-f filename Determines whether the file filename is a true file, and if the file does not exist, returns false.
-G pathname Determine if the path pathname is set Sgid bit, if the path does not exist return false.
-h filename Determines whether the file filename is a linked file, and returns False if the file does not exist.
-K pathname determines if the path pathname has a "sticky" bit, and if the path does not exist return false.
-p filename Determines whether the file filename is a pipe file and returns False if the file does not exist.
-R pathname Determines if the path pathname is readable and returns false if the path does not exist.
-s filename to determine whether the file filename is larger than 0, if the file does not exist return false.
-s filename to determine if the file filename is a socket, and the file does not exist to return false.
-U pathname determine if the path pathname has a suid bit set, and if the path does not exist, return false.
-W pathname Determines whether the path pathname is writable, and if the path does not exist, returns false.
-X pathname Determines whether the path pathname is executable, and if the path does not exist return false.
-O pathname determine if the path pathname is owned by the current user, and if the path does not exist, return false.
-G pathname Determine if the user group for the path pathname is the current user group, and if the path does not exist, return false.
File1-nt File2 Determine whether the file File1 is newer than the file file2.
File1-ot file2 determine if the file File1 is older than the file file2.
Logical operations
Param1–a param2 logic and.
Param1–o param2 logic or.
! param logical Non.
Character test:
-Z string to determine whether string strings are empty strings, that is, 0 length.
-N string to determine if the string is a non-empty sequence.
string1 = string2 Determines whether the string string1 and string2 are equal.
String1! = string2 Determines whether strings string1 and string2 are unequal.
String1 < string2 sorted by character encoding table, string string1 is before string2.
String1 > string2 sorted by Character encoding table, string string1 is after string2.
Numerical test:
Val1–eq Val2 Determines whether the values of val1 and val2 are equal.
Val1–ne Val2 Determine whether the values of val1 and val2 are unequal.
Val1–lt Val2 to determine whether VAL1 is less than val2.
Val1–le Val2 determine if val1 is less than or equal to Val2.
VAL1–GT Val2 judge whether Val1 is greater than val2.
Val1–ge Val2 Judge whether the val1 is greater than or equal to Val2.
Conditional judgment in the shell