Summary of linux script judgment conditions (mandatory)

Source: Internet
Author: User
The following is a summary of the linux script judgment conditions (mandatory ). I think this is quite good. now I will share it with you and give you a reference. Let's take a look at the following:

-B file: If the file exists and is a special block file, it is true.
-C file: If the file exists and is a special character file, it is true.
-D file: If the file exists and is a directory, it is true.
-E file: true if the file exists
-F file: If the file exists and is a rule file, it is true.
-G file: If the file exists and the value of SGID is set, it is true.
-H file: true if the file exists and is a compliant link
-K file: If the file exists and the "sticky" bit value is set
-P file: If the file exists and is a named pipe, it is true.
-R file: true if the file exists and is readable
-S file: true if the file exists and its size is greater than zero
-U file: true if the file exists and the SUID bit is set
-W file: true if the file exists and can be written
-X file: true if the file exists and is executable
-O file: true if the file exists and is owned by a valid user ID

-Z string if the string length is 0, it is true
-N string: true if the string length is not 0
String1 = string2 if the two strings are equal, it is true.
String1! = String2: true if two strings are not equal

Int1-eq int2 if int1 is equal to int2, true
Int1-ne int2: true if int1 is not equal to int2
Int1-lt int2 if int1 is smaller than int2, true
Int1-le int2 if int1 is smaller than or equal to int2, true
Int1-gt int2 if int1 is greater than int2, true
Int1-ge int2 if int1 is greater than or equal to int2, true

! If expr is false, the composite expression is true. Expr can be any valid test expression
Expr1-a expr2 if both expr1 and expr2 are true, the entire formula is true.
Expr1-o expr2 if either expr1 or expr2 is true, the entire formula is true.

The above summary of the linux script judgment conditions (mandatory) is all the content shared by the editor. I hope to give you a reference and support for PHP.

For more articles about linux script judgment conditions (mandatory), refer to PHP!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.