In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "what is the function of (), (), [], [], {} in Linux Shell". In daily operation, I believe many people have doubts about the function of (), (), [], [], {} in Linux Shell. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the questions of "what is the function of (), (), [], [[]] and {} in Linux Shell?" Next, please follow the editor to study!
Parentheses, parentheses ()
1. Single parentheses ()
① command group. The command in parentheses will be executed sequentially with a new child shell, so the variables in parentheses cannot be used by the rest of the script. Multiple commands in parentheses are separated by semicolons, the last command can be without a semicolon, and there is no need to have a space between each command and the parentheses.
The ② command is replaced. It is equivalent to cmd,shell scanning the command line and finding the structure, then cmd the structure, then execute the cmd in (cmd) once to get its standard output, and then put this output to the original command. Some shell do not support it, such as tcsh.
③ is used to initialize the array. Such as: array= (a b c d) 2, double parentheses (()) ① integer extension. This extended calculation is integer and does not support floating-point computing. The ((exp)) structure extends and evaluates the value of an arithmetic expression. If the result of the expression is 0, the exit status code returned is 1, or "false", while the exit status code returned by a non-zero expression will be 0, or "true". For logical judgment, the expression exp is 1 if it is true and 0 if it is false. ② can be used in ((exp)) or even trinomial operators as long as the operators and expressions in parentheses conform to the operational rules of C language. When doing different carry operations (such as binary, octal, hexadecimal), the output is automatically converted to decimal. For example, the result of echo ((16,5f)) is 95 (hexadecimal decimal) ③ can also redefine the value of a variable simply with (()), such as axi5; ((axi5f)) can redefine $an as 6.
④ is often used for arithmetic comparisons, and variables in double parentheses do not use symbolic prefixes. Multiple expressions are supported in parentheses separated by commas. As long as the expression in parentheses conforms to the C language operation rules, for example, you can directly use for (
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.