Logical symbols
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 detection is a "block file"
- C detection is a "character file"
- s detection is a "socket tag file"
- L detection is a "symbolic Link's profile"
- E detects if "something" exists!
2. about the program's Logical volume label!
- g detection is owned by the program performed 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 of the file detection!
- R to detect if a property is readable
- w detection is a property that can be written
- x detect whether the property is executable
- s detection is a "non-blank file"
- U detect if a property with "SUID"
- g detection for properties with "SGID"
- K detect if there is a property of "sticky bit"
4. judgment and comparison 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" "or (OR)"
The meaning of && logic
|| The meaning of a logical OR
Operation symbols
= equals applies To: integer or string comparison if in [], only the string
! = is 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: integer comparison
-le less than or equal to: integer comparison
-ge greater than or equal to: integer comparison
- A both are established (and) logical Expressions –a logical expressions
- o unilateral formation (or) logical expression –o logical expression
- Z empty string
- N non-empty string
This article is from the "Linux_woniu" blog, make sure to keep this source http://llu1314.blog.51cto.com/5925801/1965332
Shell logical operators, logical expressions