In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
I. the logical relationship between commands:
Logic and: &, the previous expression is false, the result is false; the second paragraph no longer needs to be judged, that is, the second paragraph is no longer running. The previous expression is true, and then run the next expression, and if the next expression is also true, the result is true.
Summary: two expressions run and operate. If two expressions are true, the result is true; otherwise, it is false.
Logical OR: | |, the previous expression is true, the result is true, and the second paragraph is no longer judged. If the first expression is false, the next expression is run, the second expression is false, the result is false, the second expression is true, and the result is true.
Summary: if two expressions run or operate, if one expression is true, the result is true; if both expressions are false, the result is false.
Example:
[$FINLINES-gt] & & echo "/ etc/inittab is a big file." | | echo "/ etc/inittab is a small file"
-1-2-3-
Description: when 1 is true, the result of 2 / 1 and 2 / 2 is true, followed by or operation, that is, paragraph 3 is no longer executed.
When 1 is false, it is followed by the operation, paragraph 2 is not executed, 1 and 2 are false and the result is false, followed by or, execute paragraph 3
2. Arithmetic operation
How to do arithmetic in shell: shell itself treats all variables as characters. If you want to do arithmetic, you need to do extra processing. Multiplication symbols, using *, may sometimes need to be escaped.
For all of the following results, you can use echo $C to see the results of variable C.
1. Let arithmetic expression
Atom 3
Bamboo 6
Let C=$A+$B # let do arithmetic, add, subtract, multiply and divide
2. $[arithmetic expression]
Cations $[$Amoy B]
3. $((arithmetic expression))
C $(($Aids B)
4. Expr arithmetic expression with spaces between operands and operators in the expression and using command reference
C = `expr $A + $B `
Dashed $(expr $A + $B) # here, there should be spaces on both sides of the operator.
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.