Shell and if-related parameters

Source: Internet
Author: User
Tags locale sorts

[ -a FILE ] FILEtrue if it exists.
[ -b FILE ] True if it FILE exists and is a block special file.
[ -c FILE ] FILEtrue if a special file is present and is a word.
[ -d FILE ] True if it FILE exists and is a directory.
[ -e FILE ] FILEtrue if it exists.
[ -f FILE ] True if it FILE exists and is an ordinary file.
[ -g FILE ] FILEtrue if Sgid is present and has been set.
[ -h FILE ] True if it FILE exists and is a symbolic connection.
[ -k FILE ] True if the FILE sticky bit is present and has been set.
[ -p FILE ] True if it FILE exists and is a name pipe (f if o).
[ -r FILE ] True if it FILE exists and is readable.
[ -s FILE ] FILEtrue if it exists and the size is not 0.
[ -t FD ] True if the file descriptor is FD open and points to a terminal.
[ -u FILE ] True if the FILE suid (set user ID) is present and set.
[ -w FILE ] FILEtrue if FILE exists and is writable.
[ -x FILE ] True if it FILE exists and is executable.
[ -O FILE ] FILEtrue if it exists and is a valid user ID.
[ -G FILE ] FILEtrue if it exists and is a valid user group.
[ -L FILE ] True if it FILE exists and is a symbolic connection.
[ -N FILE ] If FILE an and has been mod is present, if the IED since it is last read is true.
[ -S FILE ] True if it FILE exists and is a socket.
[file1 -nt file2 ] if file1 has been Changed more recently than file2 , or if file1 exists and file2 does not is true.
[file1 -ot file2 ] if file1 than file2 to be old, or file2 exists and file1 The is true if it does not exist.
[ FILE1 -ef FILE2 ] FILE1true if and FILE2 point to the same device and node number.
[ -o Optionname] True if the shell option "optionname" is turned on.
[ -zSTRING] "STRING" is true if the length is zero.
[ -nString] or [string] Thelength of "STRING" is not 0 Non-zero is true.
[STRING1 = = STRING2] If 2 strings are the same. "=" May is used instead of "= =" For strict POSIX compliance is true.
[STRING1! = STRING2] True if the strings are not equal.
[STRING1 < STRING2] If the "STRING1" sorts before "STRING2" lexicographically The current locale is true.
[STRING1 > STRING2] If the "STRING1" sorts after "STRING2" lexicographically The current locale is true.
[ARG1 OP ARG2] "OP" is one -eq of,,, -ne -lt -le , -gt or -ge . These arithmetic binary operators return True if "ARG1" is equal to, not equal to, less than, less than or equal to, g Reater than, or greater than or equal to "ARG2", respectively. "ARG1" and "ARG2" are integers.

Shell and if-related parameters

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.