Shell if judge commonly used in the green part, the tail part of the more do not understand. Reproduced from Baidu Library.
[-A file] if FILE existence is true.
[-B-file] True if file exists and is a block-specific file.
[-C file] is true if file exists and is a word special file.
[-D file] is true if FILE exists and is a directory.
[-e-file] is true if FILE exists.
[-F file] is true if file exists and is a normal file.
[-G file] True if FILE exists and Sgid is already set.
[-H file] True if FILE exists and is a symbolic connection.
[-K-file] True if file exists and a sticky bit has been set.
[-P file] If FILE exists and is a name pipe (f if O) true.
[-R File] True if FILE exists and is readable.
[-S file] true if FILE exists and the size is not O.
[-T FD] true if the file descriptor FD is open and points to a terminal.
[-U FILE] true if FILE exists and suid (set user ID) is set.
[-W file] If file is true if file exists and is writable.
[-X file] True if FILE exists and is executable.
[-O FILE] is true if FILE exists and is a valid user ID.
[-G file] True if FILE exists and is a valid user group.
[-L file] true if FILE exists and is a symbolic connection.
[-N file] If FILE exists and has been mod if IED since it is last read is true.
[-S file] is true if FILE exists and is a socket.
[File1-nt FILE2] If FILE1 has been changed more recently than-FILE2, or if FILE1 exists and FILE2 does is true.
[File1-ot FILE2] True if FILE1 is older than FILE2, or FILE2 exists and FILE1 does not exist.
[File1-ef FILE2] True if FILE1 and FILE2 point to the same device and node number.
[-O Optionname] true if the shell option "Optionname" is turned on.
[-Z STRING] The length of "STRING" is zero is true.
The length of [-N string] or [string] "string" is not 0 Non-zero is true.
[STRING1 = = STRING2] If 2 strings are the same. "=" May is used instead of "= =" for strict POSIX compliance is true.
[STRING1!= STRING2] True if the string is not equal.
[STRING1 < STRING2] if "STRING1" sorts before "STRING2" lexicographically in the current locale is true.
[STRING1 > STRING2] If "STRING1" sorts after "STRING2" lexicographically to the current locale is true.
[ARG1 OP ARG2] "OP" is one of-eq,-ne,-lt,-le,-gt Or-ge. These arithmetic binary operators return true if "ARG1" are equal to, not equal to, less than, less than or equal to, great Er than, or greater than or equal to "ARG2", respectively. "ARG1" and "ARG2" are integers.