
Table of Contents
Chapter 21. Restricted Shells.........................................................................................................................359
Chapter 22. Process Substitution...................................................................................................................361
Chapter 23. Functions....................................................................................................................................364
23.1. Complex Functions and Function Complexities.........................................................................367
23.2. Local Variables...........................................................................................................................377
23.2.1. Local variables and recursion............................................................................................378
23.3. Recursion Without Local Variables............................................................................................380
Chapter 24. Aliases.........................................................................................................................................383
Chapter 25. List Constructs...........................................................................................................................386
Chapter 26. Arrays.........................................................................................................................................389
Chapter 27. /dev and /proc.............................................................................................................................417
27.1. /dev..............................................................................................................................................417
27.2. /proc............................................................................................................................................419
Chapter 28. Of Zeros and Nulls.....................................................................................................................425
Chapter 29. Debugging...................................................................................................................................429
Chapter 30. Options........................................................................................................................................439
Chapter 31. Gotchas.......................................................................................................................................441
Chapter 32. Scripting With Style..................................................................................................................449
32.1. Unofficial Shell Scripting Stylesheet..........................................................................................449
Chapter 33. Miscellany...................................................................................................................................452
33.1. Interactive and non-interactive shells and scripts.......................................................................452
33.2. Operator Precedence...................................................................................................................453
33.3. Shell Wrappers............................................................................................................................455
33.4. Tests and Comparisons: Alternatives..........................................................................................460
33.5. A script calling itself (recursion)................................................................................................460
33.6. "Colorizing" Scripts....................................................................................................................463
33.7. Optimizations..............................................................................................................................475
33.8. Assorted Tips..............................................................................................................................476
33.8.1. Ideas for more powerful scripts.........................................................................................476
33.8.2. Widgets..............................................................................................................................485
33.9. Security Issues............................................................................................................................487
33.9.1. Infected Shell Scripts.........................................................................................................487
33.9.2. Hiding Shell Script Source................................................................................................487
33.9.3. Writing Secure Shell Scripts.............................................................................................488
33.10. Portability Issues.......................................................................................................................488
33.11. Shell Scripting Under Windows...............................................................................................489
Advanced Bash-Scripting Guide
iii