当前位置:网站首页>Integer comparison expression of shell command

Integer comparison expression of shell command

2020-12-07 11:03:30 osc_ rt7omcc0

stay [ ] perhaps test The following parameters are used in :

-eq      equal   
-ne      It's not equal 
-gt      Greater than 
-ge     Greater than or equal to 
-lt       Less than 
-le     Less than or equal to 

stay (()) perhaps [[ ]] Use the following parameters :

== perhaps =
!=
>
>=
<
<=

The two cannot be mixed up , Examples are as follows :

shell Order   Integer comparison expression
shell Order   Integer comparison expression
2>1 If you don't add space, you have to add \ escape ,
therefore , When choosing eq ne When you wait for an expression like this , Both sides must be integers .


版权声明
本文为[osc_ rt7omcc0]所创,转载请带上原文链接,感谢
https://chowdera.com/2020/12/20201207105953089g.html