Find a very detailed Linux shell script tutorial, in fact, not only the shell script programming, but also introduced the system of various commands
Http://vdisk.weibo.com/s/yVBlEojGMQMpv
This book is divided into five parts, in detail the shell programming skills, a variety of UNIX commands and syntax, but also related to UNIX under the word processing and a small number of system management problems. The book is comprehensive, concise and smooth text, suitable for shell programmers to learn, reference.
Directory
Translator sequence
Objective
First part shell
1th. File Security and Permissions 1
1.1 Files 1
1.2 File Type 2
1.3 Permissions 2
1.4 Changing the permission bit 4
1.4.1 Symbol Mode 4
1.4.2 chmod Command Example 5
1.4.3 Absolute Mode 5
1.4.4 Other examples of CHMOD commands 6
1.4.5 can choose to use symbolic mode or absolute mode 7
1.5 Catalog 7
1.6 Suid/guid 7
1.6.1 Why to use Suid/guid 8
1.6.2 Example of setting Suid/guid 8
1.7 Chown and CHGRP 9
1.7.1 Chown Example 9
1.7.2 Chgrp Example 9
1.7.3 Find out what group of users you belong to 9
1.7.4 find out which groups other users belong to 10
1.8 Umask 10
1.8.1 how to calculate the Umask value 10
1.8.2 Common Umask Value 11
1.9 Symbolic Links 12
1.9.1 using soft links to save multiple images of a file 12
1.9.2 Symbolic Links Example 12
1.10 Summary 13
The 2nd Chapter uses find and Xargs 14
2.1 Find command Option 14
2.1.1 Using the name option 15
2.1.2 Using PERM option 16
2.1.3 Ignoring a directory 16
2.1.4 using the user and Nouser option 16
2.1.5 Using group and Nogroup option 16
2.1.6 finding files by change time 17
2.1.7 find newer or older files than a file 17
2.1.8 using the Type option 17
2.1.9 using the SIZE option 18
2.1.10 using depth Option 18
2.1.11 using the Mount option 18
2.1.12 using cpio option 18
2.1.13 using EXEC or OK to execute shell commands 19
2.1.14 example of the Find command 20
2.2 Xargs 20
2.3 Summary 21
3rd. Background Execution Command 22
3.1 Cron and crontab 22
3.1.1 Crontab Domain 22
3.1.2 Crontab Entry Example 23
3.1.3 crontab command Option 23
3.1.4 Creating a new Crontab file 24
3.1.5 List crontab Files 24
3.1.6 Edit Crontab File 24
3.1.7 Deleting crontab files 25
3.1.8 recovering lost crontab files 25
3.2 at Command 25
3.2.1 Using the AT command to submit a command or script 26
3.2.2 List the jobs submitted 27
3.2.3 Clearing a job 27
3.3 & Commands 27
3.3.1 submitting commands to the background 28
3.3.2 Viewing process 28 with PS command
3.3.3 Kill background Process 28
3.4 nohup Command 29
3.4.1 submitting a job using the nohup command 29
3.4. Submit several jobs 21 times 29
3.5 Summary 30
4th. File name Substitution 31
4.1 Use * 31
4.2 Use? 32
4.3 using [...] and [!...] 32
4.4 Summary 33
5th shell input and output 34
5.1 Echo 34
5.2 Read 35
5.3 Cat 37
5.4 Pipe 38
5.5 Tee 39
5.6 standard input, output, and error 40
5.6.1 Standard input 40
5.6.2 Standard output 40
5.6.3 Standard Error 40
5.7 File Redirection 40
5.7.1 REDIRECT Standard output 41
5.7.2 REDIRECT Standard input 42
5.7.3 Redirection standard Error 42
5.8 using standard output and standard error 43
5.9 Merge standard output and standard error 43
5.10 EXEC 44
5.11 Using file descriptors 44
5.12 Summary 45
Chapter 6th order Execution Sequence 46
6.1 Use && 46
6.2 Use | | 46
6.3 Combine commands with () and {} 47
6.4 Summary 48
Part Two text filtering
7th. Introduction to Regular Expressions 49
7.1 Using a period to match a single character 50
7.2 matches a string or character sequence at the beginning of a line 50
7.3 Match string or character at end of line with $51
7.4 Use * to match single characters or duplicates in a string
Sequence 51
7.5 using \ Masking the meaning of a special character 52
7.6 using [] to match a range or set 52
7.7 Number of occurrences of matching pattern results using \{\} 53
7.8 Summary 55
8th grep Family 56
8.1 grep 57
8.1.1 Double Quote Quote 57
8.1.2 grep option 57
8.1.3 Querying multiple Files 57
8.1.4 Line Match 57
8.1.5 Number of rows 58
8.1.6 displaying non-matching rows 58
8.1.7 Exact Match 58
8.1.8 Case Sensitive 58
8.2 grep and Regular Expressions 58
8.2.1 Mode Range 59
8.2.2 does not match the beginning of the line 59
8.2.3 Setting Case 59
8.2.4 match any character 59
8.2.5 Date Query 59
8.2.6 Range Combination 60
60 probability of 8.2.7 mode occurrence
8.2.8 using grep to match "and" or "or" mode 61
8.2.9 Blank Line 61
8.2.10 Matching special characters 61
8.2.11 query format file name 61
8.2.12 Querying IP Address 61
8.3 Class name 62
8.4 System grep Command 62
8.4.1 Catalogue 63
8.4.2 passwd File 63
8.4.3 using the PS command 63
8.4.4 using grep 64 on a string
8.5 Egrep 64
8.6 Summary 65
Chapter 9th awk Introduction 66
9.1 Calling Awk 66
9.2 awk Script 67
9.2.1 Modes and Actions 67
9.2.2 Fields and records 67
9.2.3 awk Express expressions and their operations 70
9.2.4-dollar character 70
9.2.5 conditional operator 70
9.2.6 awk built-in variable 73
9.2.7 NF, nr and filename 74
9.2.8 awk operator 75
9.2.9 built-in string functions 78
9.2.10 String Mask Sequence 80
9.2.11 awk output Function printf 81
9.2.12 printf Modifier 81
9.2.13 awk Array 86
9.3 Summary 88
Chapter 10th Introduction to SED usage 89
10.1 sed How to read data 89
10.2 Calling SED 89
10.2.1 Save SED Output 90
10.2.2 How to query text in a file using SED 90
10.2.3 basic sed Edit Command 90
10.3 sed and regular Expressions 91
10.4 Basic SED Programming Example 91
10.4.1 using P (rint) to display line 91
10.4.2 Print Range 91
10.4.3 Print Mode 92
10.4.4 querying using patterns and line numbers 92
10.4.5 match Meta-character 92
10.4.6 displaying the entire file 92
10.4.7 any character 92
10.4.8 First line 92
10.4.9 last line 93
10.4.10 Print line number 93
10.4.11 Additional text 93
10.4.12 Creating an SED script file 94
10.4.13 inserting text 94
10.4.14 Modifying Text 95
10.4.15 Deleting text 96
10.4.16 replacing text 96
10.5 Using the Replace modifier string 97
10.6 Writing SED results to file command 97
10.7 reading text from a file 98
10.8 Match back out 98
10.9 displaying control characters in a file 99
10.10 Using the system sed 99
10.10.1 Handling Control characters 99
10.10.2 Processing Message Output 101
10.10.3 removing the beginning number 101
10.10.4 Additional Text 102
10.10.5 from Shell to sed value 102
10.10.6 Setting the shell variable from the SED output 102
10.11 Quick Line Command 102
10.12 Summary 103
11th Chapter merger and Division 104
11.1 Sort Usage 104
11.1.1 Overview 104
11.1.2 Sort Option 104
11.1.3 Saving Output 105
11.1.4 Sort Start Mode 105
11.1.5 Sort Reference method to a field 105
11.1.6 File Classified 105
11.1.7 Basic Sort 106
11.1.8 Sort category Inverse 106
11.1.9 by specified field category 106
11.1.10 Numerical Field Classification 106
11.1.11 Uniqueness Category 107
11.1.12 other sort methods using K 108
11.1.13 sorting keys using K 108
11.1.14 specifying the sort sequence 108
11.1.15 POS Usage 108
11.1.16 using head and tail to classify output 109
11.1.17 awk using the sort output result 109
11.1.18 merging two classification files 110
11.2 System Sort 110
11.3 Uniq Usage 111
11.4 Join Usage 112
11.5 Cut Usage 114
11.5.1 using the domain separator 115
11.5.2 clipping a specified field 115
11.6 Paste Usage 116
11.6.1 Specifying Columns 116
11.6.2 using a different domain delimiter 116
11.6.3 Paste command Pipeline Input 117
11.7 Split Usage 117
11.8 Summary 118
Chapter 12th TR Usage 119
12.1 About TR 119
12.1.1 Character Range 119
12.1.2 Saving Output 120
12.1.3 removing repeated occurrences of characters 120
12.1.4 Delete blank line 120
12.1.5 Uppercase to lowercase 121
12.1.6 Lowercase to uppercase 121
12.1.7 delete a specified character 121
12.1.8 Conversion Control character 122
12.1.9 Fast Conversion 122
12.1.10 matches more than one character 123
12.2 Summary 123
Part III Login Environment
13th Chapter Login Environment 125
13.1/etc/profile 125
13.2 Users of $home.profile 128
13.3 Stty Usage 129
13.4 Create a. logout file 131
13.5 Summary 131
Chapter 14th Environment and Shell variables 132
14.1 What is a shell variable 132
14.2 Local Variables 132
14.2.1 Display Variable 133
14.2.2 Clearing variables 133
14.2.3 Show all local shell variables 133
14.2.4 Binding Variable Value 134
14.2.5 test whether the variable has been set 134
14.2.6 using variables to save System command parameters 135
14.2.7 setting read-only variables 135
14.3 Environment Variables 136
14.3.1 Setting Environment Variables 136
14.3.2 Display Environment Variables 136
14.3.3 Clearing Environment Variables 137
14.3.4 Embedding Shell Variables 137
14.3.5 Other environment Variables 139
14.3.6 SET Command 140
14.3.7 exporting variables to child process 140
14.4 Position Variable Parameter 141
14.4.1 using positional parameters in scripts 142
14.4.2 passing Parameters 142 to system commands
14.4.3 specific variable parameter 143
14.4.4 Final Exit Status 144
14.5 Summary 145
15th Chapter quotation marks 146
15.1 Reference Necessity 146
15.2 double quotes 146
15.3 Single quotes 147
15.4 Anti-Quote 147
15.5 Backslash 148
15.6 Summary 149
Part IV basic Shell programming
16th Shell Script Introduction 151
16.1 reasons for using shell scripts 151
16.2 Script Content 151
16.3 Running a script 152
16.4 Summary 153
17th Condition Test 154
17.1 Test File Status 154
17.2 using logical operators when testing 155
17.3 String Test 155
17.4 Test Value 156
17.5 Expr Usage 157
17.5.1 Increment Count 158
17.5.2 Numerical Test 158
17.5.3 Pattern Matching 158
17.6 Summary 159
18th Chapter Control Flow structure 160
18.1 Exit Status 160
18.2 Control Structure 160
18.2.1 Flow Control 161
18.2.2 Cycle 161
18.3 If then Else statement 161
18.3.1 Simple If Statement 162
18.3.2 Variable Value Test 162
18.3.3 grep output Check 163
18.3.4 testing grep output with variables 163
18.3.5 file copy output check 164
18.3.6 Current Catalog Test 164
18.3.7 File Permissions Test 165
18.3.8 test passed to parameter 165 in the script
18.3.9 determines whether the script is interactive mode 165
18.3.10 simple if Else statement 166
18.3.11 variable setting test 166
18.3.12 Detecting the user running the script 166
18.3.13 passing script parameters to system command 167
18.3.14 null: Command usage 167
18.3.15 Test Catalog Creation Results 168
18.3.16 another copy instance 169
18.3. More than 17 if statements 169
18.3.18 testing and setting environment variables 169
18.3.19 Detecting final Command status 170
18.3.20 adding and detecting integer values 171
18.3.21 Simple Secure Login Script 172
18.3.22 elif Usage 173
18.3.23 using Elif for multi-condition detection 173
18.3.24 Multi-file location detection 174
18.4 Case Statement 175
18.4.1 Simple Case Statement 175
18.4.2 using the matching pattern | 176
18.4.3 prompt type Y or n 177
18.4.4 case and Command parameter pass 177
18.4.5 capture input and execute NULL command 178
18.4.6 Default Variable Value 179
18.5 for Loop 180
18.5.1 Simple for Loop 181
18.5.2 Printing a string list 181
18.5.3 using the LS command for A For loop 181
18.5.4 using parameter 182 for A For loop
18.5.5 using a For loop to connect to server 183
18.5.6 using a For loop to back up files 183
18.5.7 Multi-File conversion 183
18.5.8 Multi-SED delete operation 184
18.5.9 Cycle Count 184
18.5.10 for Loop and local document 184
18.5.11 for Loop embedding 185
18.6 until cycle 186
18.6.1 Simple until cycle 186
18.6.2 Monitoring Files 187
18.6.3 Monitoring disk space 187
18.7 while loop 188
18.7.1 Simple While loop 188
18.7.2 using the While loop to read keyboard input 188
18.7.3 reading data from a file using the while loop 189
18.7.4 using IFS to read files 189
18.7.5 file handling with test conditions 190
18.7.6 scan file lines for number of statistics 191
18.7.7 each read a pair of records 193
18.7.8 Ignore # character 193
18.7.9 working with formatted reports 194
18.7.10 while loop and file descriptor 196
18.8 using break and continue to control loops 197
18.8.1 Break 197
18.8.2 jump out of Case statement 197
18.8.3 Continue 197
18.8.4 browsing the file line 198
18.9 Menu 199
18.10 Summary 201
19th Shell Function 202
19.1 Defining a function in a script 203
19.2 using functions in Scripts 203
19.3 passing parameters to a function 203
19.4 returning from the calling function 203
19.5 function return value test 204
19.6 using functions in the shell 204
19.7 Creating a function file 204
19.8 Locating files 205
19.9 checking the Load function 205
19.10 Executing the SHELL function 205
19.10.1 Removing shell Functions 206
19.10.2 Editing Shell Functions 206
19.10.3 Function Example 207
19.10.4 to set functions together 219
19.11 Function Call 219
19.11.1 calling a function in a script 219
19.11.2 calling a function from a function file 220
19.12 locating files is not used for functions 222
19.13 Summary 223
20th pass parameter 224 to script
20.1 Shift Command 225
20.1.1 shift Command Simple usage 225
20.1.2 the last parameter of the command line input 225
20.1.3 using shift to process file conversions 226
20.2 Getopts 229
20.2.1 getopts Script Instance 229
20.2.2 getopts mode of Use 231
20.2.3 using Getopts to specify the value of the variable 231
20.2.4 Access Value Method 232
20.2.5 using getopts to process file conversions 233
20.3 Summary 235
21st. Create Screen Output 236
21.1 Tput Usage 236
21.1.1 string Output 236
21.1.2 Digital Output 237
21.1.3 Boolean output 237
21.2 Tput Usage 237
21.2.1 Setting the tput command 237
21.2.2 using Boolean output 237
21.2.3 using tput 237 in scripts
21.2.4 Generating escape sequences 238
21.2.5 Cursor Position 239
21.2.6 displaying text 240 in the center of the screen
21.2.7 Finding terminal Properties 240
21.2.8 using function keys in Scripts 241
21.2.9 using color 242
21.2.10 Producing color 243
21.2.11 Creating a sophisticated menu 246
21.3 Summary 251
22nd. Create Screen Input 252
22.1 Adding records 252
22.2 Deleting Records 262
22.3 Modifying records 266
22.4 Viewing Records 270
22.5 Summary 273
23rd Debug Script 274
23.1 General error 274
23.1.1 Loop Error 274
23.1.2 typical missing Write quotes 274
23.1.3 Test Error 274
23.1.4 Character Case 275
23.1.5 for Loop 275
23.1.6 Echo 275
23.2 SET Command 275
23.3 Summary 276
24th Shell Embedding Command 277
24.1 Shell Embedding Command complete list 277
24.1.1 PWD 277
24.1.2 Set 278
24.1.3 Times 278
24.1.4 Type 278
24.1.5 Ulimit 279
24.1.6 Wait 279
24.2 Summary 279
Part V advanced Shell programming Tips
25th. In-depth discussion << 281
25.1 quickly create a file 281
25.2 quickly create a printed document 281
25.3 Automatic Selection Menu 282
25.4 Automatic FTP Transfer 283
25.5 Accessing the database 286
25.6 Summary 288
Chapter 26th Shell Tools 289
26.1 Creating a file that holds information 289
26.1.1 creating a log file using the date command 289
26.1.2 creating a unique temporary file 290
26.2 signal 291
26.2.1 kills a process 292
26.2.2 Detection Signal 293
26.3 Trap 294
26.3.1 capture the signal and take action accordingly 294
26.3.2 captures the signal and takes action on the other
An example 295
26.3.3 Locking Terminal 297
26.3.4 Ignoring signal 298
26.4 Eval 300
26.4.1 executing a command containing a string 300
26.4.2 gives each value a variable name 301
26.5 Logger Command 302
26.5.1 using the Logger command 303
26.5.2 using the Logger command in a script 303
26.6 Summary 305
The 27th chapter several script example 306
27.1 Pingall 306
27.2 Backup_gen 306
27.3 Del.lines 312
27.4 Access.deny 313
27.5 Logroll 316
27.6 Nfsdown 317
27.7 Summary 317
28th Run Level script 318
28.1 How to know if the system contains running
Level table of Contents 318
28.2 determining the current RunLevel 319
28.3 Quick familiarity with Inittab 319
28.4 Run level 320
28.4.1 various operating levels 321
28.4.2 the format of a run-level script 321
28.4.3 Install run Level script 322
28.5 using Inittab to start an application 323
28.6 other ways to start and stop services 324
28.7 Summary 324
29th CGI Script 325
29.1 What is a Web page? 325
29.2 CGI 325
29.3 connecting to a Web server 326
29.4 CGI and HTM scripts 326
29.4.1 Basic CGI Script 326
29.4.2 Show shell command output 328
29.4.3 using SSI 330
29.4.4 Access Counter 330
29.4.5 uses a link to display the current web
Environment Variables 332
29.4.6 Other common environment variables 334
29.5 get and Post methods Introduction 335
29.5.1 Get Method 335
29.5.2 Post Method 340
29.5.3 Populating list Items 347
29.5.4 Auto Refresh page 348
29.6 Summary 349
Appendix Common shell Commands 350
Linux and Unix shell Programming Guide (Full HD version). pdf