Shell condition judgment

Source: Internet
Author: User

first, the numerical judgmentInt1-eq INT2 INT1 and INT2 two number equal true Int1-ne INT2 INT1 and INT2 two number of true int1-gt INT2 INT1 greater than INT1 for true int1-g e INT2 INT1 greater than or equal to INT2 true

Int1-lt INT2 INT1 Less than INT2 is true

Int1-le INT2 INT1 less than or equal to INT2 true second, the string judgment[-Z string] True if the length of the string is zero, that is, if the null is true, and [-N string] is true if the length of the string is nonzero, that is, the non-null is true; [STRING1 = STRING2] if two strings The same is true; [STRING1! = STRING2] True if the string is not the same; [STRING1] True if the string is not empty, similar to-n third, File/folder (directory) Judgment[-B file] True if file exists and is a block special file. [-C file] True if file exists and is a word special. [-D DIR] true if FILE exists and is a directory. [-E File] True if file exists. [-F file] True if file exists and is a normal file. [-G file] True if file exists and Sgid has been set. [-K file] True if file exists and the sticky bit has been set. [-P file] If file exists and is a name pipe (f if O) is true. [-R File] True if file exists and is readable.[-S file] True if file exists and the size is not 0. [-T FD] true if the file descriptor FD is open and points to a terminal. [-u file] True if file exists and suid (set user ID) is set. [-W file] True if file exists and is writable. [-X file] True if file exists and is executable. [-o file] True if file exists and is a valid user ID. [-G file] True if file exists and is a valid user group. [-L file] True if file exists and is a symbolic connection. [-N file] If file exists and has been mod if IED since it is last read is true. [-S file] True if file exists and is a socket. [File1-nt FILE2] If FILE1 have been changed more recently than FILE2, or if FILE1 exists and FILE2 does not is true. [File1-ot FILE2] If FILE1 is older than FILE2, or FILE2 exists and FILE1 does not exist, it is true. [File1-ef FILE2] True if FILE1 and FILE2 point to the same device and node number. Iv. complex logic judgment-A with-O or! Non -

Shell condition judgment

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.