I have come back to learn about Linux technology-general Linux technology-Linux programming and kernel information. The following is a detailed description. I finally started the technology again! Numerous conversations with students prove that our school is mainly used to despise the theory. If I want to keep myself alone, the advantages of baoyan will be completely lost, which is no different from seeking for fish. Therefore, at least most of the time in school, I want to develop myself into a technical talent. I don't want to be a master, especially in theory, "Easy to hide" is an asshole in school. I also want to try my best to do experiments. The experience in the bubble machine room is wealth, and the result is a master.
So! I started to learn Linux/shell this afternoon.
I think that self-learning is a kind of thing that doesn't require any foundation or profound knowledge. It is said that this is a so-called "hands-on ability". I thought that it was a shame to rely on this kind of smart thinking, now the opposite is true.
Environment: Common Bourne Shell
Condition: Internet, Redflag Workstation 5. 0
Time: 8 hours
Conclusion: The example is everything, and reading code is a shortcut.
Abstract record:
1. Control statement
While Do
...
Done
If Then
...
Else
...
Fi
Similar to the C language, there are:
1. The statement does not need to end with a semicolon. The statement must be surrounded by do... done or if... then... fi.
2. Operators in conditional expressions have special symbols.
3. The definition of variables does not need to be explained. When referencing a variable, the variable name is represented by the prefix $ rather than the shell command. It is better to enclose the variable name with {} For readability; generally, I call the 'expr' shell command to calculate the integer variable. It requires the $ prefix variable and the operator needs to be surrounded by 'operator' to distinguish it from special characters; when using the let command or (expression) for computation, it does not need to be more close to the written mathematical formula.
4. It is best to assign a value to an internal variable in the front of the script, for example, $1, $2..., $ #, $ @, $? $, Etc.
5. other unstated statements, Simply put: write by row-book, sort by semantic order, and use standard regular expressions based on shell commands
6. Some operators:-lt-gt-eq-le-ge-ne (compare the size)
-E-f-B-l-d (File Attribute determination)
$ PS1 (level 1 prompt)
$ PS2 (second-level prompt)
1> & 2 (redirection merge of standard output and standard error, specified at the front of the statement sequence)
7. Function body Definition
Function ()
{
...
[Return something]
}
Its parameters are passed in through the script parameters. It is best to assign a value to the local variable inside the function body to facilitate tracking and debugging. The local variable starts with an underscore and calls shell commands that are predefined in the same system.
Its parameters are passed in through the script parameters. It is best to assign a value to the local variable inside the function body to facilitate tracking and debugging. The local variable starts with an underscore and calls shell commands that are predefined in the same system.
So much.
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