Chapter 1. The Bash Shell

This reference covers Bash, which is the primary shell for GNU/Linux and Mac OS X. In particular, it covers version 3.1 of Bash. Bash is available for Solaris and can be easily compiled for just about any other Unix system. This reference presents the following topics:

  • History

  • Overview of features

  • Invoking the shell

  • Syntax

  • Functions

  • Variables

  • Arithmetic expressions

  • Command history

  • Job control

  • Shell options

  • Command execution

  • Restricted shells

  • Built-in commands

  • Resources

History

The original Bourne shell distributed with V7 Unix in 1979 became the standard shell for writing shell scripts. The Bourne shell is still be found in /bin/sh on many commercial Unix systems. The Bourne shell itself has not changed that much since its initial release, although it has seen modest enhancements over the years. The most notable new features were the CDPATH variable and a built-in test command with System III (circa 1980), command hashing and shell functions for System V Release 2 (circa 1984), and the addition of job control features for System V Release 4 (1989).

Because the Berkeley C shell (csh) offered features that were more pleasant for interactive use, such as command history and job control, for a long time the standard practice in the Unix world was to use the Bourne shell for programming and the C shell for daily use. David Korn at Bell Labs was the first developer to enhance the Bourne shell by adding csh-like features to it: history, job control, and additional programmability. ...

Get bash Quick Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.