The Bourne Shell (sh)

The Bourne shell, whose executable is named sh, was written by Stephen R. Bourne at Bell Laboratories and distributed as the standard command interpreter with Version 7 Unix in 1979. It replaced the earlier and simpler Thompson shell. In his 1978 paper in the Bell System Technical Journal, “UNIX Time-Sharing System: The UNIX Shell,” Bourne described the shell as both a command interpreter, run interactively or with input taken from a file, and a programming language providing control flow, variables, and parameter passing.

Bourne’s design treated the shell as a genuine programming language. The paper documents constructs that remain familiar today: the for loop, the case statement, the if and while constructs, command substitution, and shell variables. Commands could be combined with pipes so that the output of one became the input of the next, and input and output could be redirected to and from files. These mechanisms let users build sophisticated programs out of small standalone utilities, which became a defining characteristic of working in Unix.

The Version 7 manual page for sh, preserved in archives of the original documentation, enumerates the shell’s behavior precisely: how it parses commands, performs filename generation, handles quoting, and runs its built-in commands. Bourne also introduced conventions that endured, including the use of special parameters and the practice of returning an exit status that the shell could test. The shell read startup behavior from the environment and passed environment variables to the programs it launched, establishing a model of process inheritance still in use.

Because Version 7 Unix was widely distributed to universities and licensees, the Bourne shell’s syntax spread across the industry and became the de facto standard for Unix scripting. When the IEEE and The Open Group later codified a portable shell in the POSIX standard (the Shell Command Language), they took the Bourne shell as the foundation. Later shells, most notably the Korn shell and the GNU Bourne-Again Shell (Bash), were written to be backward compatible with sh, which is why scripts beginning with the sh interpreter still run decades after they were written.

The Bourne shell’s influence is therefore structural rather than merely historical. Its grammar is the grammar that POSIX standardized and that Bash, Dash, ksh, and other shells implement; its philosophy of composing small tools through pipes and redirection shaped how generations of programmers automate work. Stephen Bourne’s sh stands as one of the most consequential pieces of software to come out of Bell Labs, alongside Unix and the C language with which it grew up.