0. Basic knowledge required for shell scripts
-vi/vim editor commands, including vimrc settings;
-Linux command basics
-Network services ( nfs, rsync, inotify, lanmp, sersync, ssh key) batch distribution management
1. Introduction to shell script
1.1 What is shell
1.2 What shell script
1.3 The role of shell programs in operation and maintenance work
1.4 Types of scripting languages
1.4.1 Types of shell script languages
1.4.2 Other commonly used script languages
1.5 OS default shell
1.6 Creation and execution of shell script scripts
2. Shell variables from shallow to deep
2.1 Variable type
2.2 Environment variables
2.3 Customized environment variables (global variables)
2.4 Display and cancel environment variables
2.5 Local variables
2.5.1 Define local variables
2.5.2 Special variables
2.5.3 Internal variables
2.5.4 Variable substring operations
2.5.5 Numerical calculation of variables
3. Conditional test
3.1 Test statement
3.1.1 Conditional test syntax
3.1.2 File test Operator
3.1.3 String test operator
3.1.4 Integer binary comparison operator
3.1.5 Logical operator
3.2 Conditional test example
3.2.1 File test example
3.2.2 String test example
3.2.3 Integer test example
3.2.4 Usage of test command testing
3.2.5 Examples of logical operators
4. Branch and loop structures
4.1 if statement
4.1.1 if condition Sentence syntax description
4.1.2 If conditional sentence example
4.1.3 Multi-judgment conditional if statement (&&, ||)
4.2 case conditional sentence
4.2.1 Case conditional sentence syntax
4.2.2 Case structure conditional sentence self-writing example
4.2.3 Case structure conditional sentence system script example
4.2. 4 System benchmark script
4.3 When type loop and until type loop
4.3.1 When type and until type loop syntax
4.3.2 Basics of when type and until type loop Example
4.3.3 Advanced production practical example expansion
4.4 for loop structure
4.4.1 for loop structure syntax
4.4.2 for loop structure Basic example
4.4.3 In-depth example of for loop structure
4.4.4 Advanced example of for loop structure
5. break continue exit
5.1 break continue exit comparison
5.2 break continue exit example
6. Shell function
6.1 shell function syntax
6.2 shell function execution
6.3 Shell function example
7. shell script debug
7.1 Examples of common script errors
7.1.1 The if conditional sentence lacks the if ending keyword
7.1. 2 Missing keyword error in the loop structure
7.1.3 Paired symbols are missing, causing an error
7.1.4 There are no spaces at both ends of the square brackets [], causing an error
7.2 Shell script debugging skills
7.2.1 Use dos2unix command to process scripts
7.2.2 Use echo command to debug
7.2.3 Use bash command parameters to debug
7.2.4 Use the set command to debug part of the script content
8. Shell script development habits, specifications, read-only
8.1 Naming convention
8.1.1 Version and run Rigel
8.1.2 Variable naming
8.1.3 Function naming
8.1.4 Script (module) naming
8.1.5 Temporary File naming
8.2 Code style specification
8.2.1 Code framework
8.2.2 Function specification
8.2.3 Conditional statements and loops
8.3 Comment specifications
8.3.1 File/module comments
8.3.2 Important function comments
8.3.3 Good habits of writing comments
8.4 Reference symbol usage specifications
8.5 Log specifications
8.6 Interface file specifications
8.7 Configuration specifications
8.7.1 Configuration file specifications
8.7.2 Inspection of configuration items
8.8 Script storage specifications
8.9 Supplementary specification development habits
9. Configuration adjustment and optimization of shell development environment
9.1 Set up SecureCRT terminal vim shell environment configuration
9.2 vim shell environment function
9.2.1 SecureCTR terminal vim automatically adds copyright function information
9.2.2 vim editing Automatic completion function of paired brackets in the vim editor
9.2.3 Automatic completion function of functions and other functions in the vim editor
9.2.4 Automatic indentation, highlighting, etc. in the vim editor
9.3 vim shell environment configuration.vimrc implementation code and parameters
7.2 shell script debug skills
The above is the detailed content of Detailed explanation of advanced programming of shell scripts. For more information, please follow other related articles on the PHP Chinese website!