Table of Contents
7.1. Test Constructs...........................................................................................................................................89
Notes......................................................................................................................................................96
7.2. File test operators.......................................................................................................................................97
Notes....................................................................................................................................................100
7.3. Other Comparison Operators.................................................................................................................101
Notes....................................................................................................................................................106
7.4. Nested if/then Condition Tests................................................................................................................107
7.5. Testing Your Knowledge of Tests...........................................................................................................109
Chapter 8. Operations and Related Topics..................................................................................................111
8.1. Operators..................................................................................................................................................113
Notes....................................................................................................................................................119
8.2. Numerical Constants...............................................................................................................................121
8.3. The Double-Parentheses Construct........................................................................................................123
8.4. Operator Precedence...............................................................................................................................125
Notes....................................................................................................................................................127
Part 3. Beyond the Basics...............................................................................................................................129
Chapter 9. Another Look at Variables.........................................................................................................131
9.1. Internal Variables....................................................................................................................................133
Notes....................................................................................................................................................151
9.2. Typing variables: declare or typeset......................................................................................................153
9.2.1. Another use for declare..............................................................................................................155
Notes..............................................................................................................................................155
9.3. $RANDOM: generate random integer...................................................................................................157
Notes....................................................................................................................................................167
Chapter 10. Manipulating Variables.............................................................................................................169
10.1. Manipulating Strings.............................................................................................................................171
10.1.1. Manipulating strings using awk...............................................................................................178
10.1.2. Further Reference.....................................................................................................................179
Notes..............................................................................................................................................179
Advanced Bash-Scripting Guide
ii