Shell if judgment statement

Source: Internet
Author: User
Primary Meaning
[- File] True ifFileExists.
[-B File] True ifFileExists and is a block-special file.
[-C File] True ifFileExists and is a character-special file.
[-D File] True ifFileExists and is a directory.
[-E File] True ifFileExists.
[-F File] True ifFileExists and is a regular file.
[-G File] True ifFileExists and its SGID bit is set.
[-H File] True ifFileExists and is a symbolic link.
[-K File] True ifFileExists and Its Sticky Bit is set.
[-P File] True ifFileExists and is a named pipe (FIFO ).
[-R File] True ifFileExists and is readable.
[-S File] True ifFileExists and has a size greater than zero.
[-T FD] True if file descriptorFDIs open and refers to a terminal.
[-U File] True ifFileExists and its SUID (Set User ID) bit is set.
[-W File] True ifFileExists and is writable.
[-X File] True ifFileExists and is executable.
[-O File] True ifFileExists and is owned by the specified tive user ID.
[-G File] True ifFileExists and is owned by the specified tive group ID.
[-L File] True ifFileExists and is a symbolic link.
[-N File] True ifFileExists and has been modified since it was last read.
[-S File] True ifFileExists and is a socket.
[File1 -NT File2] True ifFile1Has been changed more recentlyFile2, Or ifFile1Exists andFile2Does not.
[File1 -Ot File2] True ifFile1Is olderFile2, Or isFile2Exists andFile1Does not.
[File1 -Ef File2] True ifFile1AndFile2Refer to the same device and inode numbers.
[-OOptionname] True if shell option "optionname" is enabled.
[-ZString] True of the length if "string" is zero.
[-NString] or [String] True if the length of "string" is non-zero.
[String1 = string2] True if the strings are equal. "=" may be used instead of "=" for strict POSIX compliance.
[String1! = String2] True if the strings are not equal.
[String1 <string2] True if "string1" sorts before "string2" lexicographically in the current locale.
[String1> string2] True if "string1" sorts after "string2" lexicographically in the current locale.
[Arg1 op arg2] "Op" is one-EQ,-Ne,-Lt,-Le,-GTOr-Ge. These arithmetic binary operators return true if "arg1" is equal to, not equal to, less than, less than or equal to, greater than, or greater than or equal to "arg2 ", respectively. "arg1" and "arg2" are integers.


Shell if judgment statement

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.