Title graphic

Here is Where the Fun Begins

With the thousands of commands available to the command line user, how can we remember them all? The answer is, we don't. The real power of the computer is its ability to do the work for us. To get it to do that, we use the power of the shell to automate things. We write shell scripts.

What are Shell Scripts?

In the simplest terms, a shell script is a file containing a series of commands. The shell reads this file and carries out the commands as though they have been entered directly on the command line.

The shell is somewhat unique, in that it is both a powerful command line interface to the system and a scripting language interpreter. As we will see, most of the things that can be done on the command line can be done in scripts, and most of the things that can be done in scripts can be done on the command line.

We have already covered many shell features, but we have focused on those features most often used directly on the command line. The shell also provides a set of features usually (but not always) used when writing programs.

Scripts unlock the power of our Linux machine. So let's have some fun!

Contents

  1. Writing Our First Script and Getting It to Work
  2. Editing the Scripts We Already Have
  3. Here Scripts
  4. Variables
  5. Command Substitution and Constants
  6. Shell Functions
  7. Some Real Work
  8. Flow Control - Part 1
  9. Stay Out of Trouble
  10. Keyboard Input and Arithmetic
  11. Flow Control - Part 2
  12. Positional Parameters
  13. Flow Control - Part 3
  14. Errors and Signals and Traps (Oh My!) - Part 1
  15. Errors and Signals and Traps (Oh My!) - Part 2