| |
| |
List of Tables | |
| |
| |
List of Figures | |
| |
| |
Preface | |
| |
| |
That No One Will Ever Read | |
| |
| |
Author's Note Regarding the ksh93 Edition | |
| |
| |
| |
Before Writing Your First KornShell Scripts | |
| |
| |
| |
Getting Started | |
| |
| |
What Shell Is Executing My Script? | |
| |
| |
Operating System Commands in a Shell Script | |
| |
| |
Beware: Are You Allowed to Execute This Script? | |
| |
| |
Commenting Your Code | |
| |
| |
Beware: Picking a Bad Name for Your Script | |
| |
| |
The Usage Line | |
| |
| |
Simple Output | |
| |
| |
Variables | |
| |
| |
Beware: Variable Names Are Case Sensitive | |
| |
| |
Simple Input | |
| |
| |
Obtaining the Value of a Variable | |
| |
| |
Beware: The Dollar Sign in Read Statements | |
| |
| |
Newlines, Semicolons, White Space, and Columns | |
| |
| |
Beware: Confusing + and - | |
| |
| |
Assigning a Value to a Variable | |
| |
| |
Beware: Common Mistakes When Assigning Variables | |
| |
| |
Finding Your Mistakes | |
| |
| |
Can I Quote You on That? | |
| |
| |
| |
Data Types | |
| |
| |
If You're New to Programming | |
| |
| |
If You're an Experienced Programmer | |
| |
| |
Declaring Strings | |
| |
| |
Declaring Integers | |
| |
| |
Binary, Octal, Hex, and So On | |
| |
| |
Declaring Floats | |
| |
| |
Declaring Constants | |
| |
| |
Declaring nameref Variables | |
| |
| |
Declaring Arrays | |
| |
| |
Declaring Arrays with set -A | |
| |
| |
Printing Array Values | |
| |
| |
Beware: Common Array Mistakes | |
| |
| |
Declaring Associative Arrays | |
| |
| |
Probing Arrays | |
| |
| |
Declaring Structures Part I | |
| |
| |
Declaring Structures Part II | |
| |
| |
Arrays of Structures | |
| |
| |
| |
Math | |
| |
| |
If You're New to Programming | |
| |
| |
If You're an Experienced Programmer | |
| |
| |
Double Parentheses | |
| |
| |
Integer Addition, Subtraction, and Multiplication | |
| |
| |
Integer Division | |
| |
| |
Floating-Point Math | |
| |
| |
Mixing Floating-Point and Integer Math | |
| |
| |
Grouping Mathematical Operations | |
| |
| |
Beware: Common Mistakes in Math Operations | |
| |
| |
Mathematical Assignment Operators | |
| |
| |
The Triggy Stuff | |
| |
| |
Beware: Math Functions Inside Double Parentheses | |
| |
| |
A Practical Math Example | |
| |
| |
Math Operator Summary | |
| |
| |
| |
Pattern Matching. If You're New to Programming | |
| |
| |
If You're an Experienced Programmer | |
| |
| |
For Everyone | |
| |
| |
The ? Wildcard | |
| |
| |
The [char1char2...charN] Wildcard | |
| |
| |
Character Classes | |
| |
| |
The * Wildcard | |
| |
| |
Beware: Matching Filenames | |
| |
| |
The ?(pattern1 | |
| |
| |
Beware: White Space within Patterns | |
| |
| |
The @(pattern1 | |
| |
| |
The !(pattern1 | |
| |
| |
The +(pattern1 | |
| |
| |
The !(subpattern1 | |
| |
| |
Matching Subpatterns with \d | |
| |
| |
Simple Commands Containing Patterns | |
| |
| |
Wildcard Summary | |
| |
| |
| |
Conditions | |
| |
| |
If You're New to Programming | |
| |
| |
If You're an Experienced Programmer | |
| |
| |
Tests on Numbers and Strings | |
| |
| |
Comparing Numbers with if | |
| |
| |
Beware: Common Mistakes Using if with Numbers | |
| |
| |
Comparing Numbers with the ? : Operator | |
| |
| |
Beware: Common Mistakes in ? : Compound Statements. else and elif | |
| |
| |
Comparing Strings with if | |
| |
| |
Comparing Alphabetical Order with < and > | |
| |
| |
Comparing a String to a Pattern with if | |
| |
| |
Beware: Common Mistakes Comparing | |