In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces the use of logic or & and in the shell script, the article is very detailed, has a certain reference value, interested friends must read it!
Logical or & and operations are very useful when using multiple conditions in our program (script). Or between two or more conditions. If any condition returns true, it returns true. And used between two or more conditions. True is returned only if all conditions are returned to true.
Use logical or
Logic may be used with the operator-o in bash scripts. The following shell script shows how to use logical OR (- o) between two conditions.
#! / bin/bashread-p "Enter First Numeric Value:" firstread-p "Enter Second Numeric Value:" secondif [$first-le 10-o$second-gt 20] then echo "OK" else echo "Not OK" fi
Use logic vs.
The logic in the bash script is used with the operator-a. The following shell script shows how to use logic and (- a) between two conditions.
#! / bin/bashread-p "Enter First Numeric Value:" firstread-p "Enter Second Numeric Value:" secondif [$first-le 10-a$second-gt 20] then echo "OK" else echo "Not OK" fi
Logic or & mixed with
The following example shows how to use multiple logical operators in a single statement.
#! / bin/bashread-p "Enter Your Number:" iif [($I-ge 10-a $I-le 20)-o ($I-ge 100-a $I-le 200)] then echo "OK" else echo "Not OK" fi is all the content that uses logical or & and methods in shell scripts. Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.