Linux Shell Test

Source: Internet
Author: User
Tags bit set

(EXPRESSION)

Expression is true expression true


! EXPRESSION

Expression is false expression false


Expression1-a EXPRESSION2

Both EXPRESSION1 and EXPRESSION2 are true both true


Expression1-o EXPRESSION2

Either EXPRESSION1 or EXPRESSION2 is true one of them is true


-N STRING

The length of string is nonzero string length not 0


String equivalent To-n string


-Z STRING

The length of string is a zero string is 0


STRING1 = STRING2

The strings are equal strings are equal


STRING1! = STRING2

The strings is not equal strings are unequal


Integer1-eq INTEGER2

INTEGER1 is equal to INTEGER2 INTEGER1 equals INTEGER2


Integer1-ge INTEGER2

INTEGER1 is greater than or equal to INTEGER2 INTEGER1 greater than or equal to INTEGER2


INTEGER1-GT INTEGER2

INTEGER1 is greater than INTEGER2 INTEGER1 greater than INTEGER2


Integer1-le INTEGER2

INTEGER1 is lesser than or equal to INTEGER2 INTEGER1 are less than or equal to INTEGER2


Integer1-lt INTEGER2

INTEGER1 is less than INTEGER2 INTEGER1 smaller than INTEGER2


Integer1-ne INTEGER2

INTEGER1 isn't equal to INTEGER2 INTEGER1 does not equal INTEGER2


File1-ef FILE2

FILE1 and FILE2 have the same device and inode numbers


File1-nt FILE2

FILE1 is newer (modification date) than FILE2


File1-ot FILE2

FILE1 is older than FILE2


-B FILE

File exists and is block special file exists and is a block special file


-C FILE

File exists and is character special files exist and are character special files


-D FILE

File exists and is a directory file exist and are directories


-E FILE

File exists files exist


-F FILE

File exists and is a regular file files exist and are regular files


-G FILE

File exists and is Set-group-id files exist and group IDs are set


-G FILE

File exists and is owned by the effective group ID file exists and is a valid group ID


-H FILE

File exists and is a symbolic link (same as-l) files exist and are symbolic links


-K FILE

File exists and have its sticky bit set file exists and Sticky-bit permissions are set


-L FILE

File exists and is a symbolic link (same as-h) files exist and are symbolic links


-O FILE

File exists and is owned by the effective user ID file exists and is owner-valid


-P FILE

FILE exists and is a named pipe


-R FILE

File exists and Read permission is granted files exist and are readable


-S FILE

File exists and has a size greater than zero file exists and non-0


-S FILE

File exists and is a socket file exists and is a socket file


-T FD file descriptor FD is opened on a terminal


-U FILE

File exists and its Set-user-id bit is set file exists with Set-user-id bit permission set


-W FILE

File exists and write permission is granted file exists and is writable


-X FILE

File exists and execute (or search) permission is granted files exist and are executable


Linux Shell Test

Related Article

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.