CLASS="book" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" >
Bash Guide for Beginners
Machtelt Garrels
Garrels BVBA
<
tille wants no spam _at_ garrels dot be
>
Version 1.11 Last updated 20081227 Edition
Table of Contents
Introduction
1.
Why this guide?
2.
Who should read this book?
3.
New versions, translations and availability
4.
Revision History
5.
Contributions
6.
Feedback
7.
Copyright information
8.
What do you need?
9.
Conventions used in this document
10.
Organization of this document
1.
Bash and Bash scripts
1.1.
Common shell programs
1.2.
Advantages of the Bourne Again SHell
1.3.
Executing commands
1.4.
Building blocks
1.5.
Developing good scripts
1.6.
Summary
1.7.
Exercises
2.
Writing and debugging scripts
2.1.
Creating and running a script
2.2.
Script basics
2.3.
Debugging Bash scripts
2.4.
Summary
2.5.
Exercises
3.
The Bash environment
3.1.
Shell initialization files
3.2.
Variables
3.3.
Quoting characters
3.4.
Shell expansion
3.5.
Aliases
3.6.
More Bash options
3.7.
Summary
3.8.
Exercises
4.
Regular expressions
4.1.
Regular expressions
4.2.
Examples using grep
4.3.
Pattern matching using Bash features
4.4.
Summary
4.5.
Exercises
5.
The GNU sed stream editor
5.1.
Introduction
5.2.
Interactive editing
5.3.
Non-interactive editing
5.4.
Summary
5.5.
Exercises
6.
The GNU awk programming language
6.1.
Getting started with gawk
6.2.
The print program
6.3.
Gawk variables
6.4.
Summary
6.5.
Exercises
7.
Conditional statements
7.1.
Introduction to if
7.2.
More advanced if usage
7.3.
Using case statements
7.4.
Summary
7.5.
Exercises
8.
Writing interactive scripts
8.1.
Displaying user messages
8.2.
Catching user input
8.3.
Summary
8.4.
Exercises
9.
Repetitive tasks
9.1.
The for loop
9.2.
The while loop
9.3.
The until loop
9.4.
I/O redirection and loops
9.5.
Break and continue
9.6.
Making menus with the select built-in
9.7.
The shift built-in
9.8.
Summary
9.9.
Exercises
10.
More on variables
10.1.
Types of variables
10.2.
Array variables
10.3.
Operations on variables
10.4.
Summary
10.5.
Exercises
11.
Functions
11.1.
Introduction
11.2.
Examples of functions in scripts
11.3.
Summary
11.4.
Exercises
12.
Catching signals
12.1.
Signals
12.2.
Traps
12.3.
Summary
12.4.
Exercises
A.
Shell Features
A.1.
Common features
A.2.
Differing features
Glossary
Index
List of Tables
1.
Typographic and usage conventions
1-1.
Overview of programming terms
2-1.
Overview of set debugging options
3-1.
Reserved Bourne shell variables
3-2.
Reserved Bash variables
3-3.
Special bash variables
3-4.
Arithmetic operators
4-1.
Regular expression operators
5-1.
Sed editing commands
5-2.
Sed options
6-1.
Formatting characters for gawk
7-1.
Primary expressions
7-2.
Combining expressions
8-1.
Escape sequences used by the echo command
8-2.
Options to the read built-in
10-1.
Options to the declare built-in
12-1.
Control signals in Bash
12-2.
Common kill signals
A-1.
Common Shell Features
A-2.
Differing Shell Features
List of Figures
1.
Bash Guide for Beginners front cover
2-1.
script1.sh
3-1.
Different prompts for different users
6-1.
Fields in awk
7-1.
Testing of a command line argument with if
7-2.
Example using Boolean operators
Next
Introduction