First, the Logical volume label
Logical Volume Label |
Express meaning |
1. |
About the file and directory of the detection of Logical volume label! |
-F |
Common! Detect if "Archive" exists eg:if [-f filename] |
-D |
Common! Detects if the directory exists |
-B |
Detects if it is a "block file" |
-C |
Detects if it is a "character file" |
-S |
Detects if it is a "socket tag file" |
-L |
Detects if it is a "symbolic Link's profile" |
-E |
Detect if "something" exists! |
2. |
About the logical volume label of the program! |
-G |
Detect whether the program owned by the GID |
-O |
Detection is owned by the program executed by the UID |
-P |
Detects if a name pipe or FIFO is being transmitted between programs (to be honest, this is not a good idea!). ) |
3. |
About the property detection of the file! |
-R |
Detect if a property is readable |
-W |
Detects if a property can be written |
-X |
Detect whether the property is executable |
-S |
Detects if it is a "non-blank file" |
-U |
Detect if a property with "SUID" is |
-G |
Detect if a property with "SGID" is |
-K |
Detect if a property with "sticky bit" is |
4. |
judgments and comparisons between two files ; for example [Test file1-nt file2] |
-nt |
The first file is newer than the second one. |
-ot |
The first file is older than the second one. |
-ef |
The first file is the same file as the second file (link and other files) |
5. |
Logical AND (and) "or (OR)" |
&& |
The meaning of the logical and |
|| |
The meaning of a logical OR |
Second, operational symbols
Operation symbols |
Representative meaning |
= |
Equal to: Integer or string comparison if in [], only the string |
!= |
Not equal to: integer or string comparison if in [], only the string |
< |
Less than applied: integer comparison in [], cannot use the representation string |
> |
Greater than applied: integer comparison in [], cannot use the representation string |
-eq |
equals applies To: integer comparison |
-ne |
Not equal to: integer comparison |
-lt |
Less than applied to: integer comparison |
-gt |
Greater than applied to: integer comparison |
-le |
Less than or equal to: integer comparison |
-ge |
Greater than or equal to: integer comparison |
-A |
Both sides established (and) logical Expressions –a logical expressions |
-O |
Single-sided (or) logical expression –o logical expression |
-Z |
Empty string |
-N |
Non-empty string |
Linux Shell logical operators