Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are Shell expressions and operators

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces what Shell expressions and operators have. The introduction in the article is very detailed and has certain reference value. Interested friends must read it!

3.1 conditional expression

expression

example

[ expression ][ 1 -eq 1 ]` expression `` 1 -eq 1 `test expressiontest 1 -eq 1 , equivalent to []

3.2 integer comparator

comparison operator

described

example

-eq, equal to [ 1 -eq 1 ] for true-ne, not equal to [ 1 -ne 1 ] for false-gt, greater than [ 2 -gt 1 ] for true-lt, lesser than [ 2 -lt 1 ] for false-ge, greater or equal to [ 2 -gt 1 ] for true-le, lesser or equal to [ 2 -le 1 ] for false

3.3 string comparator

operator

described

example

====[ "a" == "a" ] is true!= is not equal to [ "a" != "a" ] is false> greater than, judging strings according to ASCII code table order, rarely used

In [] expression: [ 2 \> 1 ] is true

In [[]] expression: [[ 2 > 1 ]] is true

In the expression (()):(( 3 > 2 )) is true

= greater than or equal to In the expression (()):(( 3 >= 2 )) is true

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report