Shell tips and knowledge points: After a command is executed, ignore the returned value and continue executing the next line www.2cto.com & amp; it indicates that only the preceding command is true to continue executing the subsequent command; otherwise, it is ignored and can be understood as short-circuit execution. | it indicates that the execution is continued only when the preceding command is false... shell tips and knowledge points: After a command is executed, ignore the returned value, and continue to execute the next line www.2cto.com & indicates that only the previous line is true to continue executing the subsequent command, otherwise ignore, it can be understood as short-circuit execution. | indicates that the command after the sub-statement is executed only when the sub-statement is set to false. this is easier to understand than the previous explanation. it is best to enclose it in quotation marks, otherwise it is easy to be understood by shell as a command, which is easy to neglect. {} is a command block writing method: the append operation www.2cto.com export is used to upgrade a variable to the environment variable str = this line of code indicates that the str variable is set to null $ {str:-+ = expr, you also need to consolidate the source to regard the script as part of the current shell process, instead of generating a sub shell process to execute the script. the source is used to load public functions, it can be understood that import exec is used to end the current shell process, and generate a new process to execute the script () to put multiple commands into a sub shell process for execution, it can be understood as converting an expression into a function {} to an anonymous function. generally, $ () and ''are the same in awk. However, the former has a higher degree of recognition and is recommended to be used frequently, the latter is easy to confuse with ''. the other one is easier to nest, but the former has poor portability. $ {} apart from defining variables, there is also a function to implement substring operations for string variables, # indicates removing the left, % indicates removing the right, singular indicates the minimum matching, double indicates the maximum matching, and can be remembered by the position # and % on the keyboard relative to $, most of the command parameters in linux are difficult to remember: ($ {} can also be used to set the default value. this is more complex. you can even calculate the variable length () by using $ {# str () is used to define an array, and access to the array uses []. Note that the subscript base of the array is 0, and @ is used to indicate all, it can be understood that all $ () is only applicable to arithmetic and logical operations. the variables in it do not need to carry the $ prefix. of course, it is not the case that 0 in the wrong shell indicates true, non-zero: false () is used for direct computation, which makes our code more concise. for example, the variable does not need to add $ prefix $0 to indicate the script path, $1... n indicates that the parameter function after the script path can be understood as the script in the script, but $0 in the function still indicates the script path, instead of the function name $10, it does not indicate the tenth parameter, but a value of 0 is followed by the first parameter. generally, # has a large relationship with the number. for example, $ {# str} indicates the variable length, and $ # indicates the number of parameters. test whether the parameter is passed [$ # = 0].
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service