The nature of the test:
is an action command
Determine if the condition is true based on the $? return value
Operating Specifications:
Format 1:test conditional expression
Format 2: [Conditional expression]
Contact method for the test operation:
Direct root && echo YES to determine results
Usage: [conditional expression] && echo YES
Test examples:
[-D "/etc/fstab"] && echo YES
[-D "/boot/fstab"] && echo YES
[-F "/etc/fstab"] && echo YES
[-F "/boot"] && echo YES
Presence and Identification:
-E: Whether the target exists
-D: Whether it is a directory
-F: Whether it is a file
Detection of permissions:
-r: Read permission
-W Write permission
-X whether there are executable (excute) permissions
Integer value comparison:
-eq Equals (equal)
-ne not equal to (not equal)
-GT greater than (greater than)
-lt less than (lesser than)
-ge greater than or equal to (greater or equal)
-le less than or equal to (lesser or equal)
Integer value comparison:
[$ (who | wc-l)-eq 2] && echo YES
[$USER = "root"] && echo YES
Linux-shell Test