Thompson shell
Encyclopedia
The Thompson shell was the first Unix shell
, introduced in the first version of Unix
in 1971, and was written by Ken Thompson.
It was a simple command interpreter, not designed for scripting, but nonetheless introduced several innovative features to the command line interface and led to the development of the later Unix shells.
.
An early feature of the Thompson shell was a compact syntax for input/output redirection. In Multics, redirecting the input or output of a command required separate commands to start and stop redirection; in Unix, one could simply add an argument to the command line consisting of the < symbol followed by a filename for input or the > symbol for output, and the shell would redirect I/O for the duration of the command. This syntax was already present by the release of the first version of Unix in 1971.
A later addition was the concept of pipes
. At the suggestion of Douglas McIlroy
, the redirection syntax was expanded so that the output of one command could be passed to the input of another command. The original pipe syntax, as described in the Version 3 manual, was:
command1 >command2>
This syntax proved too ambiguous and was easily confused with redirection to and from files. By Version 4, the syntax had changed to use both the | and ^ symbols to denote pipes:
command1 | command2
This produces exactly the same result as:
command1 ^ command2
The Thompson shell syntax for redirection with < and >, and piping with |, has proven durable and has been adopted by most other Unix shells and command shells of several other operating systems, most notably on DOS
, OS/2
and Microsoft Windows
.
As a result, by the 1975 release of Unix Version 6, it was becoming clear that the Thompson shell was inadequate for most serious programming tasks.
At this time, the developers of the Programmer's Workbench UNIX distribution, most notably John Mashey
, began modifying the Thompson shell to make it more suitable for programming.
The result, known as the PWB shell
or the Mashey shell, included more advanced flow-control mechanisms and introduced shell variables, but remained limited by the necessity to remain compatible with the Thompson shell.
Finally, the Thompson shell was replaced as the main Unix shell by the Bourne shell
in Unix Version 7 and the C shell
in 2BSD, both released in 1979. Since virtually all modern Unix and Unix-like
systems are descended from V7 and 2BSD, the Thompson shell is generally no longer used. It is, however, available as open source
as part of several Ancient Unix
source distributions, and has been ported to modern Unices as a historical exhibit.
Unix shell
A Unix shell is a command-line interpreter or shell that provides a traditional user interface for the Unix operating system and for Unix-like systems...
, introduced in the first version of Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...
in 1971, and was written by Ken Thompson.
It was a simple command interpreter, not designed for scripting, but nonetheless introduced several innovative features to the command line interface and led to the development of the later Unix shells.
History
The name "shell" for a command line interpreter and the concept of making the shell a user program outside of the operating system kernel were introduced in Unix's precursor MulticsMultics
Multics was an influential early time-sharing operating system. The project was started in 1964 in Cambridge, Massachusetts...
.
An early feature of the Thompson shell was a compact syntax for input/output redirection. In Multics, redirecting the input or output of a command required separate commands to start and stop redirection; in Unix, one could simply add an argument to the command line consisting of the < symbol followed by a filename for input or the > symbol for output, and the shell would redirect I/O for the duration of the command. This syntax was already present by the release of the first version of Unix in 1971.
A later addition was the concept of pipes
Pipeline (Unix)
In Unix-like computer operating systems , a pipeline is the original software pipeline: a set of processes chained by their standard streams, so that the output of each process feeds directly as input to the next one. Each connection is implemented by an anonymous pipe...
. At the suggestion of Douglas McIlroy
Douglas McIlroy
Malcolm Douglas McIlroy is a mathematician, engineer, and programmer. As of 2007 he is an Adjunct Professor of Computer Science at Dartmouth College. Dr...
, the redirection syntax was expanded so that the output of one command could be passed to the input of another command. The original pipe syntax, as described in the Version 3 manual, was:
command1 >command2>
This syntax proved too ambiguous and was easily confused with redirection to and from files. By Version 4, the syntax had changed to use both the | and ^ symbols to denote pipes:
command1 | command2
This produces exactly the same result as:
command1 ^ command2
The Thompson shell syntax for redirection with < and >, and piping with |, has proven durable and has been adopted by most other Unix shells and command shells of several other operating systems, most notably on DOS
DOS
DOS, short for "Disk Operating System", is an acronym for several closely related operating systems that dominated the IBM PC compatible market between 1981 and 1995, or until about 2000 if one includes the partially DOS-based Microsoft Windows versions 95, 98, and Millennium Edition.Related...
, OS/2
OS/2
OS/2 is a computer operating system, initially created by Microsoft and IBM, then later developed by IBM exclusively. The name stands for "Operating System/2," because it was introduced as part of the same generation change release as IBM's "Personal System/2 " line of second-generation personal...
and Microsoft Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...
.
Decline and replacements
The shell's design was intentionally minimalistic; even the if and goto statements, essential for control of program flow, were implemented as separate commands.As a result, by the 1975 release of Unix Version 6, it was becoming clear that the Thompson shell was inadequate for most serious programming tasks.
At this time, the developers of the Programmer's Workbench UNIX distribution, most notably John Mashey
John Mashey
John Mashey is a computer scientist, director and entrepreneur.Mashey holds a Ph.D. in computer science from Pennsylvania State University, where he developed the ASSIST assembler language teaching software. He worked on the PWB/UNIX operating system at Bell Labs from 1973 to 1983, authoring the...
, began modifying the Thompson shell to make it more suitable for programming.
The result, known as the PWB shell
PWB shell
The PWB shell was an early Unix shell.Distributed with some versions of Programmer's Workbench UNIX circa 1975-1977, it was a modified version of the Thompson shell with additional features to increase usability for programming, and was maintained by John Mashey and various others The PWB shell...
or the Mashey shell, included more advanced flow-control mechanisms and introduced shell variables, but remained limited by the necessity to remain compatible with the Thompson shell.
Finally, the Thompson shell was replaced as the main Unix shell by the Bourne shell
Bourne shell
The Bourne shell, or sh, was the default Unix shell of Unix Version 7 and most Unix-like systems continue to have /bin/sh - which will be the Bourne shell, or a symbolic link or hard link to a compatible shell - even when more modern shells are used by most users.Developed by Stephen Bourne at AT&T...
in Unix Version 7 and the C shell
C shell
The C shell is a Unix shell that was created by Bill Joy while a graduate student at University of California, Berkeley in the late 1970s. It has been distributed widely, beginning with the 2BSD release of the BSD Unix system that Joy began distributing in 1978...
in 2BSD, both released in 1979. Since virtually all modern Unix and Unix-like
Unix-like
A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....
systems are descended from V7 and 2BSD, the Thompson shell is generally no longer used. It is, however, available as open source
Open source
The term open source describes practices in production and development that promote access to the end product's source materials. Some consider open source a philosophy, others consider it a pragmatic methodology...
as part of several Ancient Unix
Ancient UNIX Systems
Ancient UNIX is a term coined by Santa Cruz Operation, to describe early releases of the Unix code base released prior to Unix System III, particularly the Research Unix releases prior to and including Version 7 .After the publication of the Lions' book, work was undertaken to release the earlier...
source distributions, and has been ported to modern Unices as a historical exhibit.
External links
- Manual page for the Thompson shell in Unix 1st Edition.
- The Evolution of the Unix Time-Sharing System - describes the early development of the shell
- Origins of the Bourne shell - manual pages for the 3rd, 4th, and 6th edition Thompson shells, and other resources on the early shells
- Sixth Edition Thompson Shell Port - the Thompson shell and its associated utilities ported to modern Unix systems