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

巴扎黑
Release: 2017-08-12 16:40:32
Original
1446 people have browsed it

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!