| Introduction |
|
xxxi | |
|
Part I The Linux Command Line |
|
|
1 | (266) |
|
Chapter 1 Starting with Linux Shells |
|
|
3 | (20) |
|
|
|
3 | (1) |
|
Looking into the Linux kernel |
|
|
4 | (1) |
|
|
|
5 | (1) |
|
Software program management |
|
|
6 | (1) |
|
|
|
7 | (1) |
|
|
|
8 | (1) |
|
|
|
9 | (1) |
|
|
|
9 | (1) |
|
|
|
10 | (1) |
|
The Linux desktop environment |
|
|
11 | (1) |
|
|
|
11 | (1) |
|
|
|
12 | (1) |
|
|
|
13 | (1) |
|
|
|
13 | (1) |
|
|
|
14 | (3) |
|
|
|
17 | (1) |
|
|
|
17 | (1) |
|
Specialized Linux distributions |
|
|
18 | (1) |
|
|
|
19 | (2) |
|
|
|
21 | (2) |
|
Chapter 2 Getting to the Shell |
|
|
23 | (24) |
|
Reaching the Command Line |
|
|
23 | (1) |
|
|
|
24 | (1) |
|
|
|
24 | (1) |
|
Accessing CLI via a Linux Console Terminal |
|
|
25 | (3) |
|
Accessing CLI via Graphical Terminal Emulation |
|
|
28 | (1) |
|
Using the GNOME Terminal Emulator |
|
|
29 | (1) |
|
Accessing the GNOME terminal |
|
|
30 | (1) |
|
|
|
31 | (4) |
|
Using the Konsole Terminal Emulator |
|
|
35 | (1) |
|
Accessing the Konsole terminal |
|
|
35 | (2) |
|
|
|
37 | (4) |
|
Using the xterm Terminal Emulator |
|
|
41 | (1) |
|
|
|
42 | (1) |
|
|
|
43 | (1) |
|
|
|
44 | (3) |
|
Chapter 3 Basic bash Shell Commands |
|
|
47 | (38) |
|
|
|
47 | (1) |
|
|
|
48 | (1) |
|
Interacting with the bash Manual |
|
|
49 | (3) |
|
Navigating the Filesystem |
|
|
52 | (1) |
|
Looking at the Linux filesystem |
|
|
52 | (3) |
|
|
|
55 | (1) |
|
Using absolute directory references |
|
|
56 | (1) |
|
Using relative directory references |
|
|
57 | (2) |
|
Listing Files and Directories |
|
|
59 | (1) |
|
Displaying a basic listing |
|
|
59 | (2) |
|
Displaying a long listing |
|
|
61 | (1) |
|
|
|
62 | (2) |
|
|
|
64 | (1) |
|
|
|
64 | (1) |
|
|
|
65 | (3) |
|
|
|
68 | (1) |
|
|
|
68 | (2) |
|
|
|
70 | (2) |
|
|
|
72 | (1) |
|
|
|
73 | (1) |
|
|
|
73 | (1) |
|
|
|
74 | (3) |
|
|
|
77 | (1) |
|
|
|
77 | (1) |
|
|
|
78 | (1) |
|
|
|
78 | (1) |
|
|
|
79 | (1) |
|
|
|
80 | (1) |
|
|
|
81 | (1) |
|
|
|
81 | (1) |
|
|
|
82 | (1) |
|
|
|
83 | (2) |
|
Chapter 4 More bash Shell Commands |
|
|
85 | (28) |
|
|
|
85 | (1) |
|
|
|
85 | (1) |
|
|
|
86 | (3) |
|
|
|
89 | (2) |
|
|
|
91 | (1) |
|
Real-time process monitoring |
|
|
92 | (3) |
|
|
|
95 | (1) |
|
|
|
95 | (1) |
|
|
|
96 | (1) |
|
|
|
96 | (1) |
|
|
|
97 | (1) |
|
|
|
97 | (2) |
|
|
|
99 | (1) |
|
|
|
100 | (1) |
|
|
|
101 | (1) |
|
|
|
102 | (1) |
|
|
|
102 | (5) |
|
|
|
107 | (1) |
|
|
|
108 | (2) |
|
|
|
110 | (1) |
|
|
|
111 | (2) |
|
Chapter 5 Understanding the Shell |
|
|
113 | (22) |
|
|
|
113 | (2) |
|
Exploring Parent and Child Shell Relationships |
|
|
115 | (4) |
|
|
|
119 | (2) |
|
Creatively using subshells |
|
|
121 | (1) |
|
Investigating background mode |
|
|
121 | (2) |
|
Putting process lists into the background |
|
|
123 | (1) |
|
|
|
124 | (1) |
|
Understanding Shell Built-In Commands |
|
|
125 | (1) |
|
Looking at external commands |
|
|
125 | (2) |
|
Looking at built-in commands |
|
|
127 | (1) |
|
Using the history command |
|
|
128 | (3) |
|
|
|
131 | (1) |
|
|
|
132 | (3) |
|
Chapter 6 Using Linux Environment Variables |
|
|
135 | (26) |
|
Exploring Environment Variables |
|
|
135 | (1) |
|
Looking at global environment variables |
|
|
136 | (2) |
|
Looking at local environment variables |
|
|
138 | (1) |
|
Setting User-Defined Variables |
|
|
138 | (1) |
|
Setting local user-defined variables |
|
|
139 | (1) |
|
Setting global environment variables |
|
|
140 | (2) |
|
Removing Environment Variables |
|
|
142 | (1) |
|
Uncovering Default Shell Environment Variables |
|
|
143 | (5) |
|
Setting the PATH Environment Variable |
|
|
148 | (2) |
|
Locating System Environment Variables |
|
|
150 | (1) |
|
Understanding the login shell process |
|
|
150 | (1) |
|
Viewing the /etc/profile file |
|
|
151 | (3) |
|
Viewing the HME startup files |
|
|
154 | (2) |
|
Understanding the interactive shell process |
|
|
156 | (1) |
|
Understanding the non-interactive shell process |
|
|
156 | (1) |
|
Making environment variables persistent |
|
|
157 | (1) |
|
Learning about Variable Arrays |
|
|
158 | (1) |
|
|
|
159 | (2) |
|
Chapter 7 Understanding Linux File Permissions |
|
|
161 | (26) |
|
|
|
161 | (1) |
|
|
|
162 | (2) |
|
|
|
164 | (1) |
|
|
|
164 | (4) |
|
|
|
168 | (1) |
|
|
|
168 | (1) |
|
|
|
169 | (1) |
|
|
|
169 | (1) |
|
|
|
170 | (2) |
|
|
|
172 | (1) |
|
|
|
173 | (1) |
|
|
|
174 | (1) |
|
|
|
175 | (1) |
|
Decoding File Permissions |
|
|
175 | (1) |
|
Using file permission symbols |
|
|
176 | (1) |
|
|
|
177 | (2) |
|
Changing Security Settings |
|
|
179 | (1) |
|
|
|
179 | (2) |
|
|
|
181 | (1) |
|
|
|
182 | (2) |
|
|
|
184 | (3) |
|
Chapter 8 Managing Filesystems |
|
|
187 | (24) |
|
Exploring Linux Filesystems |
|
|
187 | (1) |
|
Understanding the basic Linux filesystems |
|
|
188 | (1) |
|
Looking at the ext filesystem |
|
|
188 | (1) |
|
Looking at the ext2 filesystem |
|
|
188 | (1) |
|
Understanding journaling filesystems |
|
|
189 | (1) |
|
Looking at the ext3 filesystem |
|
|
190 | (1) |
|
Looking at the ext4 filesystem |
|
|
190 | (1) |
|
Looking at the Reiser filesystem |
|
|
190 | (1) |
|
Looking at the journaled filesystem |
|
|
191 | (1) |
|
Looking at the XFS filesystem |
|
|
191 | (1) |
|
Understanding the copy-on-write filesystems |
|
|
192 | (1) |
|
Looking at the ZFS filesystem |
|
|
192 | (1) |
|
Looking at the Btrfs filesystem |
|
|
192 | (1) |
|
|
|
192 | (1) |
|
|
|
193 | (3) |
|
|
|
196 | (2) |
|
Checking and repairing a filesystem |
|
|
198 | (2) |
|
|
|
200 | (1) |
|
Exploring logical volume management layout |
|
|
200 | (1) |
|
|
|
201 | (1) |
|
|
|
202 | (1) |
|
|
|
202 | (1) |
|
|
|
202 | (1) |
|
|
|
203 | (1) |
|
Defining physical volumes |
|
|
203 | (2) |
|
|
|
205 | (1) |
|
|
|
206 | (2) |
|
|
|
208 | (1) |
|
|
|
209 | (1) |
|
|
|
210 | (1) |
|
Chapter 9 Installing Software |
|
|
211 | (22) |
|
Package Management Primer |
|
|
211 | (1) |
|
|
|
212 | (1) |
|
Managing packages with aptitude |
|
|
212 | (3) |
|
Installing software packages with aptitude |
|
|
215 | (2) |
|
Updating software with aptitude |
|
|
217 | (1) |
|
Uninstalling software with aptitude |
|
|
218 | (1) |
|
The aptitude repositories |
|
|
219 | (2) |
|
The Red Hat-Based Systems |
|
|
221 | (1) |
|
Listing installed packages |
|
|
221 | (2) |
|
Installing software with yum |
|
|
223 | (1) |
|
Updating software with yum |
|
|
224 | (1) |
|
Uninstalling software with yum |
|
|
225 | (1) |
|
Dealing with broken dependencies |
|
|
225 | (2) |
|
|
|
227 | (1) |
|
Installing from Source Code |
|
|
228 | (4) |
|
|
|
232 | (1) |
|
Chapter 10 Working with Editors |
|
|
233 | (34) |
|
|
|
233 | (1) |
|
Checking your vim package |
|
|
234 | (1) |
|
|
|
235 | (3) |
|
|
|
238 | (1) |
|
|
|
238 | (1) |
|
Searching and substituting |
|
|
239 | (1) |
|
Navigating the nano Editor |
|
|
240 | (2) |
|
Exploring the emacs Editor |
|
|
242 | (1) |
|
Checking your emacs package |
|
|
243 | (2) |
|
Using emacs on the console |
|
|
245 | (1) |
|
Exploring the basics of emacs |
|
|
245 | (2) |
|
|
|
247 | (1) |
|
|
|
247 | (1) |
|
|
|
248 | (1) |
|
|
|
248 | (1) |
|
Using windows in console mode emacs |
|
|
249 | (1) |
|
|
|
250 | (1) |
|
Exploring the KDE Family of Editors |
|
|
251 | (1) |
|
Looking at the KWrite editor |
|
|
251 | (5) |
|
Looking at the Kate editor |
|
|
256 | (4) |
|
Exploring the GNOME Editor |
|
|
260 | (1) |
|
|
|
260 | (2) |
|
Understanding basic gedit features |
|
|
262 | (1) |
|
|
|
262 | (1) |
|
|
|
262 | (1) |
|
Setting editor preferences |
|
|
263 | (1) |
|
Setting font & color preferences |
|
|
264 | (1) |
|
|
|
264 | (1) |
|
|
|
265 | (2) |
|
Part II Shell Scripting Basics |
|
|
267 | (180) |
|
Chapter 11 Basic Script Building |
|
|
269 | (28) |
|
|
|
269 | (1) |
|
|
|
270 | (2) |
|
|
|
272 | (2) |
|
|
|
274 | (1) |
|
|
|
274 | (1) |
|
|
|
275 | (2) |
|
|
|
277 | (2) |
|
Redirecting Input and Output |
|
|
279 | (1) |
|
|
|
279 | (1) |
|
|
|
280 | (1) |
|
|
|
281 | (4) |
|
|
|
285 | (1) |
|
|
|
285 | (2) |
|
|
|
287 | (1) |
|
A floating-point solution |
|
|
288 | (1) |
|
|
|
288 | (1) |
|
|
|
289 | (3) |
|
|
|
292 | (1) |
|
|
|
292 | (1) |
|
|
|
293 | (2) |
|
|
|
295 | (2) |
|
Chapter 12 Using Structured Commands |
|
|
297 | (34) |
|
Working with the if-then Statement |
|
|
297 | (3) |
|
Exploring the if-then-else Statement |
|
|
300 | (1) |
|
|
|
301 | (3) |
|
|
|
304 | (3) |
|
Using numeric comparisons |
|
|
307 | (1) |
|
|
|
308 | (1) |
|
Looking at string equality |
|
|
309 | (1) |
|
|
|
310 | (2) |
|
|
|
312 | (1) |
|
|
|
313 | (1) |
|
|
|
314 | (1) |
|
Checking whether an object exists |
|
|
315 | (1) |
|
|
|
316 | (1) |
|
|
|
317 | (1) |
|
|
|
318 | (1) |
|
Checking whether you can write to a file |
|
|
319 | (2) |
|
Checking whether you can run a file |
|
|
321 | (1) |
|
|
|
321 | (1) |
|
Checking default group membership |
|
|
322 | (1) |
|
|
|
322 | (2) |
|
Considering Compound Testing |
|
|
324 | (1) |
|
Working with Advanced if-then Features |
|
|
325 | (1) |
|
|
|
325 | (1) |
|
|
|
326 | (1) |
|
Considering the case Command |
|
|
327 | (2) |
|
|
|
329 | (2) |
|
Chapter 13 More Structured Commands |
|
|
331 | (34) |
|
|
|
331 | (1) |
|
|
|
332 | (1) |
|
Reading complex values in a list |
|
|
333 | (2) |
|
Reading a list from a variable |
|
|
335 | (1) |
|
Reading values from a command |
|
|
336 | (1) |
|
Changing the field separator |
|
|
337 | (2) |
|
Reading a directory using wildcards |
|
|
339 | (2) |
|
|
|
341 | (1) |
|
The C language for command |
|
|
341 | (1) |
|
|
|
342 | (1) |
|
|
|
343 | (1) |
|
|
|
343 | (1) |
|
Using multiple test commands |
|
|
344 | (2) |
|
|
|
346 | (1) |
|
|
|
347 | (3) |
|
|
|
350 | (1) |
|
|
|
351 | (1) |
|
|
|
352 | (1) |
|
Breaking out of a single loop |
|
|
352 | (1) |
|
Breaking out of an inner loop |
|
|
353 | (1) |
|
Breaking out of an outer loop |
|
|
354 | (1) |
|
|
|
355 | (3) |
|
Processing the Output of a Loop |
|
|
358 | (1) |
|
|
|
359 | (1) |
|
|
|
359 | (2) |
|
Creating multiple user accounts |
|
|
361 | (1) |
|
|
|
362 | (3) |
|
Chapter 14 Handling User Input |
|
|
365 | (30) |
|
|
|
365 | (1) |
|
|
|
366 | (2) |
|
|
|
368 | (2) |
|
|
|
370 | (1) |
|
Using Special Parameter Variables |
|
|
371 | (1) |
|
|
|
371 | (2) |
|
|
|
373 | (2) |
|
|
|
375 | (1) |
|
|
|
376 | (1) |
|
|
|
376 | (1) |
|
Processing simple options |
|
|
377 | (1) |
|
Separating options from parameters |
|
|
378 | (1) |
|
Processing options with values |
|
|
379 | (1) |
|
|
|
380 | (1) |
|
Looking at the command format |
|
|
381 | (1) |
|
Using getopt in your scripts |
|
|
382 | (2) |
|
|
|
384 | (3) |
|
|
|
387 | (1) |
|
|
|
388 | (1) |
|
|
|
388 | (1) |
|
|
|
389 | (2) |
|
|
|
391 | (1) |
|
|
|
391 | (1) |
|
|
|
392 | (3) |
|
Chapter 15 Presenting Data |
|
|
395 | (24) |
|
Understanding Input and Output |
|
|
395 | (1) |
|
Standard file descriptors |
|
|
395 | (1) |
|
|
|
396 | (1) |
|
|
|
397 | (1) |
|
|
|
398 | (1) |
|
|
|
398 | (1) |
|
|
|
398 | (1) |
|
Redirecting errors and data |
|
|
399 | (1) |
|
Redirecting Output in Scripts |
|
|
400 | (1) |
|
|
|
400 | (1) |
|
|
|
401 | (1) |
|
Redirecting Input in Scripts |
|
|
402 | (1) |
|
Creating Your Own Redirection |
|
|
403 | (1) |
|
Creating output file descriptors |
|
|
403 | (1) |
|
Redirecting file descriptors |
|
|
404 | (1) |
|
Creating input file descriptors |
|
|
405 | (1) |
|
Creating a read/write file descriptor |
|
|
406 | (1) |
|
|
|
407 | (1) |
|
Listing Open File Descriptors |
|
|
408 | (2) |
|
Suppressing Command Output |
|
|
410 | (1) |
|
|
|
411 | (1) |
|
Creating a local temporary file |
|
|
411 | (2) |
|
Creating a temporary file in /tmp |
|
|
413 | (1) |
|
Creating a temporary directory |
|
|
413 | (1) |
|
|
|
414 | (2) |
|
|
|
416 | (2) |
|
|
|
418 | (1) |
|
Chapter 16 Script Control |
|
|
419 | (28) |
|
|
|
419 | (1) |
|
|
|
419 | (1) |
|
|
|
420 | (1) |
|
|
|
420 | (1) |
|
|
|
421 | (1) |
|
|
|
422 | (1) |
|
|
|
423 | (1) |
|
Modifying or removing a trap |
|
|
424 | (3) |
|
Running Scripts in Background Mode |
|
|
427 | (1) |
|
Running in the background |
|
|
427 | (2) |
|
Running multiple background jobs |
|
|
429 | (1) |
|
Running Scripts without a Hang-Up |
|
|
430 | (2) |
|
|
|
432 | (1) |
|
|
|
432 | (2) |
|
|
|
434 | (2) |
|
|
|
436 | (1) |
|
|
|
436 | (1) |
|
|
|
437 | (1) |
|
|
|
438 | (1) |
|
Scheduling a job using the at command |
|
|
438 | (1) |
|
Understanding the at command format |
|
|
438 | (1) |
|
|
|
439 | (1) |
|
|
|
440 | (1) |
|
|
|
441 | (1) |
|
Scheduling regular scripts |
|
|
441 | (1) |
|
Looking at the cron table |
|
|
441 | (1) |
|
|
|
442 | (1) |
|
|
|
443 | (1) |
|
Looking at the anacron program |
|
|
443 | (2) |
|
Starting scripts with a new shell |
|
|
445 | (1) |
|
|
|
446 | (1) |
|
Part III Advanced Shell Scripting |
|
|
447 | (196) |
|
Chapter 17 Creating Functions |
|
|
449 | (28) |
|
|
|
449 | (1) |
|
|
|
450 | (1) |
|
|
|
450 | (3) |
|
|
|
453 | (1) |
|
|
|
453 | (1) |
|
|
|
454 | (1) |
|
|
|
455 | (1) |
|
Using Variables in Functions |
|
|
456 | (1) |
|
Passing parameters to a function |
|
|
456 | (3) |
|
Handling variables in a function |
|
|
459 | (1) |
|
|
|
459 | (1) |
|
|
|
460 | (1) |
|
Array Variables and Functions |
|
|
461 | (1) |
|
Passing arrays to functions |
|
|
461 | (2) |
|
Returning arrays from functions |
|
|
463 | (1) |
|
|
|
464 | (1) |
|
|
|
465 | (2) |
|
Using Functions on the Command Line |
|
|
467 | (1) |
|
Creating functions on the command line |
|
|
468 | (1) |
|
Defining functions in the bashrc file |
|
|
468 | (1) |
|
Directly defining functions |
|
|
469 | (1) |
|
|
|
469 | (1) |
|
Following a Practical Example |
|
|
470 | (1) |
|
Downloading and installing |
|
|
471 | (1) |
|
|
|
471 | (1) |
|
The shtool library functions |
|
|
472 | (1) |
|
|
|
473 | (1) |
|
|
|
474 | (3) |
|
Chapter 18 Writing Scripts for Graphical Desktops |
|
|
477 | (28) |
|
|
|
477 | (1) |
|
|
|
478 | (1) |
|
Create the menu functions |
|
|
479 | (1) |
|
|
|
480 | (1) |
|
|
|
481 | (1) |
|
|
|
482 | (2) |
|
|
|
484 | (1) |
|
|
|
484 | (2) |
|
|
|
486 | (1) |
|
|
|
487 | (1) |
|
|
|
487 | (1) |
|
|
|
488 | (1) |
|
|
|
489 | (1) |
|
|
|
490 | (1) |
|
|
|
491 | (2) |
|
Using the dialog command in a script |
|
|
493 | (3) |
|
|
|
496 | (1) |
|
|
|
496 | (1) |
|
|
|
496 | (2) |
|
|
|
498 | (2) |
|
|
|
500 | (1) |
|
|
|
500 | (1) |
|
|
|
501 | (3) |
|
|
|
504 | (1) |
|
Chapter 19 Introducing sed and gawk |
|
|
505 | (30) |
|
|
|
505 | (1) |
|
Getting to know the sed editor |
|
|
505 | (1) |
|
Defining an editor command in the command line |
|
|
506 | (1) |
|
Using multiple editor commands in the command line |
|
|
507 | (1) |
|
Reading editor commands from a file |
|
|
508 | (1) |
|
Getting to know the gawk program |
|
|
509 | (1) |
|
Visiting the gawk command format |
|
|
510 | (1) |
|
Reading the program script from the command line |
|
|
510 | (1) |
|
Using data field variables |
|
|
511 | (1) |
|
Using multiple commands in the program script |
|
|
512 | (1) |
|
Reading the program from a file |
|
|
513 | (1) |
|
Running scripts before processing data |
|
|
514 | (1) |
|
Running scripts after processing data |
|
|
514 | (2) |
|
Commanding at the sed Editor Basics |
|
|
516 | (1) |
|
Introducing more substitution options |
|
|
516 | (1) |
|
|
|
516 | (2) |
|
|
|
518 | (1) |
|
|
|
518 | (1) |
|
Addressing the numeric line |
|
|
519 | (1) |
|
Using text pattern filters |
|
|
520 | (1) |
|
|
|
520 | (1) |
|
|
|
521 | (2) |
|
Inserting and appending text |
|
|
523 | (2) |
|
|
|
525 | (2) |
|
|
|
527 | (1) |
|
|
|
527 | (1) |
|
|
|
528 | (1) |
|
|
|
529 | (1) |
|
|
|
529 | (1) |
|
|
|
530 | (1) |
|
|
|
530 | (1) |
|
|
|
531 | (2) |
|
|
|
533 | (2) |
|
Chapter 20 Regular Expressions |
|
|
535 | (26) |
|
What Are Regular Expressions? |
|
|
535 | (1) |
|
|
|
535 | (1) |
|
Types of regular expressions |
|
|
536 | (1) |
|
|
|
537 | (1) |
|
|
|
537 | (2) |
|
|
|
539 | (1) |
|
|
|
540 | (1) |
|
Starting at the beginning |
|
|
540 | (1) |
|
|
|
541 | (1) |
|
|
|
542 | (1) |
|
|
|
542 | (1) |
|
|
|
543 | (3) |
|
Negating character classes |
|
|
546 | (1) |
|
|
|
546 | (1) |
|
Special character classes |
|
|
547 | (1) |
|
|
|
548 | (1) |
|
Extended Regular Expressions |
|
|
549 | (1) |
|
|
|
550 | (1) |
|
|
|
551 | (1) |
|
|
|
551 | (2) |
|
|
|
553 | (1) |
|
|
|
553 | (1) |
|
Regular Expressions in Action |
|
|
554 | (1) |
|
|
|
554 | (2) |
|
Validating a phone number |
|
|
556 | (2) |
|
Parsing an e-mail address |
|
|
558 | (2) |
|
|
|
560 | (1) |
|
|
|
561 | (30) |
|
Looking at Multiline Commands |
|
|
561 | (1) |
|
Navigating the next command |
|
|
562 | (1) |
|
Using the single-line next command |
|
|
562 | (1) |
|
|
|
563 | (3) |
|
Navigating the multiline delete command |
|
|
566 | (1) |
|
Navigating the multiline print command |
|
|
567 | (1) |
|
|
|
567 | (2) |
|
|
|
569 | (3) |
|
|
|
572 | (1) |
|
|
|
572 | (2) |
|
|
|
574 | (1) |
|
|
|
575 | (1) |
|
|
|
576 | (1) |
|
Replacing individual words |
|
|
576 | (1) |
|
Placing sed Commands in Scripts |
|
|
577 | (1) |
|
|
|
578 | (1) |
|
|
|
578 | (1) |
|
|
|
579 | (1) |
|
Spacing with double lines |
|
|
579 | (1) |
|
Spacing files that may have blanks |
|
|
580 | (1) |
|
Numbering lines in a file |
|
|
581 | (1) |
|
|
|
582 | (2) |
|
|
|
584 | (1) |
|
Deleting consecutive blank lines |
|
|
584 | (1) |
|
Deleting leading blank lines |
|
|
585 | (1) |
|
Deleting trailing blank lines |
|
|
586 | (1) |
|
|
|
586 | (2) |
|
|
|
588 | (3) |
|
|
|
591 | (32) |
|
|
|
591 | (1) |
|
|
|
592 | (1) |
|
The field and record separator variables |
|
|
592 | (3) |
|
|
|
595 | (3) |
|
|
|
598 | (1) |
|
Assigning variables in scripts |
|
|
598 | (1) |
|
Assigning variables on the command line |
|
|
599 | (1) |
|
|
|
600 | (1) |
|
|
|
600 | (1) |
|
Iterating through array variables |
|
|
601 | (1) |
|
|
|
602 | (1) |
|
|
|
602 | (1) |
|
|
|
603 | (1) |
|
|
|
603 | (1) |
|
|
|
604 | (1) |
|
|
|
605 | (1) |
|
|
|
605 | (2) |
|
|
|
607 | (1) |
|
|
|
608 | (1) |
|
|
|
609 | (1) |
|
|
|
610 | (3) |
|
|
|
613 | (1) |
|
|
|
613 | (2) |
|
|
|
615 | (1) |
|
|
|
616 | (1) |
|
|
|
617 | (1) |
|
|
|
617 | (1) |
|
|
|
618 | (1) |
|
Creating a function library |
|
|
619 | (1) |
|
Working through a Practical Example |
|
|
620 | (1) |
|
|
|
621 | (2) |
|
Chapter 23 Working with Alternative Shells |
|
|
623 | (20) |
|
|
|
623 | (1) |
|
|
|
624 | (1) |
|
The dash command line parameters |
|
|
624 | (1) |
|
The dash environment variables |
|
|
625 | (1) |
|
Default environment variables |
|
|
626 | (1) |
|
|
|
627 | (1) |
|
User-defined environment variables |
|
|
627 | (1) |
|
The dash built-in commands |
|
|
628 | (1) |
|
|
|
629 | (1) |
|
|
|
629 | (1) |
|
|
|
629 | (1) |
|
|
|
629 | (1) |
|
|
|
630 | (1) |
|
|
|
631 | (1) |
|
|
|
632 | (1) |
|
|
|
632 | (1) |
|
|
|
632 | (1) |
|
|
|
633 | (1) |
|
|
|
634 | (2) |
|
|
|
636 | (1) |
|
Viewing, adding, and removing modules |
|
|
637 | (1) |
|
|
|
638 | (1) |
|
|
|
639 | (1) |
|
|
|
639 | (1) |
|
|
|
640 | (1) |
|
|
|
640 | (1) |
|
|
|
641 | (1) |
|
|
|
642 | (1) |
|
Part IV Creating Practical Scripts |
|
|
643 | (96) |
|
Chapter 24 Writing Simple Script Utilities |
|
|
645 | (36) |
|
|
|
645 | (1) |
|
|
|
645 | (1) |
|
Obtaining the required functions |
|
|
646 | (2) |
|
Creating a daily archive location |
|
|
648 | (1) |
|
Creating a daily archive script |
|
|
649 | (2) |
|
Running the daily archive script |
|
|
651 | (1) |
|
Creating an hourly archive script |
|
|
652 | (3) |
|
Running the hourly archive script |
|
|
655 | (1) |
|
|
|
656 | (1) |
|
Obtaining the required functions |
|
|
657 | (1) |
|
Getting the correct account name |
|
|
657 | (1) |
|
Creating a function to get the correct account name |
|
|
658 | (2) |
|
Verifying the entered account name |
|
|
660 | (1) |
|
Determining whether the account exists |
|
|
661 | (1) |
|
Removing any account processes |
|
|
662 | (2) |
|
|
|
664 | (1) |
|
|
|
665 | (1) |
|
|
|
665 | (6) |
|
|
|
671 | (2) |
|
|
|
673 | (1) |
|
Obtaining the required functions |
|
|
673 | (3) |
|
|
|
676 | (1) |
|
|
|
677 | (1) |
|
|
|
678 | (3) |
|
Chapter 25 Producing Scripts for Database, Web, and E-Mail |
|
|
681 | (28) |
|
|
|
681 | (1) |
|
|
|
682 | (1) |
|
|
|
682 | (1) |
|
|
|
683 | (2) |
|
|
|
685 | (2) |
|
|
|
687 | (1) |
|
|
|
688 | (2) |
|
Inserting and deleting data |
|
|
690 | (1) |
|
|
|
691 | (1) |
|
Using the database in your scripts |
|
|
692 | (1) |
|
|
|
692 | (1) |
|
Sending commands to the server |
|
|
693 | (3) |
|
|
|
696 | (1) |
|
|
|
697 | (1) |
|
|
|
698 | (1) |
|
|
|
699 | (1) |
|
The Lynx configuration file |
|
|
700 | (1) |
|
|
|
701 | (3) |
|
|
|
704 | (4) |
|
|
|
708 | (1) |
|
Chapter 26 Creating Fun Little Shell Scripts |
|
|
709 | (30) |
|
|
|
709 | (1) |
|
Understanding the required functions |
|
|
709 | (1) |
|
Determining who is on the system |
|
|
710 | (1) |
|
|
|
710 | (1) |
|
Sending a message to another user |
|
|
711 | (1) |
|
|
|
712 | (1) |
|
Checking if user is logged on |
|
|
713 | (1) |
|
Checking if user accepts messages |
|
|
714 | (1) |
|
Checking if message was included |
|
|
715 | (1) |
|
Transmitting a simple message |
|
|
715 | (1) |
|
Transmitting a long message |
|
|
716 | (4) |
|
|
|
720 | (1) |
|
Understanding the required functions |
|
|
720 | (1) |
|
Learning about the wget utility |
|
|
720 | (3) |
|
|
|
723 | (1) |
|
|
|
724 | (1) |
|
|
|
724 | (2) |
|
Obtaining web page information |
|
|
726 | (1) |
|
Parsing out the desired information |
|
|
727 | (4) |
|
|
|
731 | (1) |
|
Understanding the required functions |
|
|
732 | (1) |
|
|
|
732 | (2) |
|
|
|
734 | (1) |
|
|
|
735 | (2) |
|
|
|
737 | (2) |
| Appendix A Quick Guide to bash Commands |
|
739 | (12) |
| Appendix B Quick Guide to sed and gawk |
|
751 | (12) |
| Index |
|
763 | |