In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "what operators are commonly used in Shell". The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn what operators are commonly used in Shell.
I. arithmetic operation
The code is as follows:
+-* /%
II. Relational operation
The code is as follows:
< >> = 0, non-empty
-f formal documents
-w writable
-L symbolic connection
The-u file has a suid bit setting
-r readable
-x executable
For example, [- w tmp.txt] tests whether the file tmp.txt is writable
2. String testing
The code is as follows:
= two strings are equal
! = two strings are not equal
-z empty string
-n non-empty string
$VAR1='abc'
$VAR2='123'
$["$VAR1" = "$VAR2"]
$echo $?
one
3. Test value
The code is as follows:
-eq equals
-ne is not equal to
-gt is greater than
-lt less than
-ge greater than or equal to
-le less than or equal to
4. Extend the test symbol [[]] (())
The code is as follows:
# [[2 > 10]] # result error
# echo $?
0
# ((2 > 10)) the result is correct
# echo $?
0
# [["aa" = "aa"]]
# echo $?
0
# (("aa" = "aa")) # result error
# echo $?
one
Thank you for your reading, the above is the content of "what are the common operators of Shell". After the study of this article, I believe you have a deeper understanding of the problem of which operators are commonly used in Shell, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.