Home  >  Article  >  Operation and Maintenance  >  Introduction to the built-in judgment statements of the shell in Linux

Introduction to the built-in judgment statements of the shell in Linux

巴扎黑
巴扎黑Original
2017-08-12 16:40:321501browse

Built-in judgment, returns 0 when successful and non-zero when unsuccessful. Next, this article will focus on introducing the built-in judgment statements of the Linux shell. Friends who are interested should take a look.

Built-in judgment, returns 0 when successful, and returns non-zero if unsuccessful

Test Judgment expression

 [Judgment expression] Note that spaces must be left before and after

Numerical operations

 -eq Equal to

 - ne Not equal to

-gt Greater than

-ge Greater than or equal to

-lt Less than

-le Less than or equal to

String operation

 = Equal to

 != Not equal to

 -z Whether it is empty

 -n Whether it is not empty

File operation

 -r Whether it exists and can be read

 -w  Whether it exists and can be written

 -x  Whether it exists and can be executed

 -f Does this file exist?

 -d Does this directory exist?

The above is the detailed content of Introduction to the built-in judgment statements of the shell in Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn