Shell Learning notes-continuous recording

Source: Internet
Author: User

1.#!/bin/sh Use the SH program to execute the code below

#!/bin/more output the code below

The code below the #!/bin/executable will be used as input to this program

2. * Can be used to match file names, regular matches, as multiplication. * * can also be used as a power operation

3. (code) Can do mathematical operations, you can also add C code

4.$ can be a defined variable that can be a regular match line terminator, $$ represents the process ID of the current shell script

5. (code) is used to create a child shell to execute the contained code, and can also be used for array initialization

6.{} A bit like the distribution law, see example:

Cat {File1,file2,file3} > Combined_file # Connect file1,file2,file3 together and redirect to Combined_file

CP File22. {txt,backup} # Copy "File22.txt" to "File22.backup"

7.[[]] double brackets

①[[is a key word for the Bash programming language.] is not a command, [[]] structure is more general than [] structure. There is no filename extension or word splitting between all characters in [[and]], but parameter extensions and command substitution occur. ②supports pattern matching of strings, and even supports the shell's regular expressions when using the =~ operator. String comparisons can be made to the right as a pattern, not just a string, such as [[Hello = = Hell]], the result is true. Matches a string or wildcard character in [[]] without the need for quotation marks. ③use [[...]] The conditional judgment structure, rather than [...], can prevent many logic errors in the script. For example,The &&, | |, <, and > operators can normally exist in the [[]] conditional judgment structure, but if they appear in the [] structure, you will get an error. ④bash sees expressions in double brackets as a single element and returns an exit status code.

8.---see page 31

Shell Learning notes-Continuous logging

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.