PWB shell
Encyclopedia
The PWB shell was an early Unix shell
.
Distributed with some versions of Programmer's Workbench UNIX circa 1975-1977, it was a modified (and generally constrained to be upward-compatible) version of the Thompson shell
with additional features to increase usability for programming, and was maintained by John Mashey
and various others (Dick Haight, Alan Glasser).
, several features introduced in the PWB shell remain in many later shells. The if and goto commands were made internal to the shell, and extended to allow if-then-else-endif, and switch
and while
constructs were introduced, as well as onintr to ignore interrupts or catch them to perform cleanup.
Simple variables could be used, although their names were limited to one letter and some letters were reserved for special purposes, of which some are the precursors of the environment variables found in all Unix systems from Version 7
onward.
For example, The $s variable was the ancestor of $HOME, used to avoid hard-coding pathnames. The $p variable was the ancestor of $PATH, which let users search for commands in their own choice of directories. Unlike most of the UNIX systems of the time, the original PWB/UNIX computer center was shared by multiple programming groups who could not change the contents of /bin or /usr/bin, but wanted to create their own sets of shared commands. In addition, the shell's command-searching was enhanced to allow shell procedures to be invoked like binary commands, i.e., if the shell found a non-binary file marked executable, it would fork another shell instance to read that file as a shell script. Thus people could type command arguments rather than sh pathname/command arguments. All this behavior was packaged as the function pexec, which was the ancestor of execvp, to allow any program to invoke commands in the same way as the shell.
The $ character (sigil
), used previously for identifying arguments to a shell script
, became the marker for dereferencing a variable, and could be used to insert a variable's value into a string in double quotes
. (In addition to later shells, this feature would also later appear in the Perl
and PHP
programming languages.)
was incompatible with the Thompson and PWB shells, but included equivalents of most of the PWB shell's features, but done from scratch, rather than incrementally, with much discussion among the various participants. In particular, Environment variables and related machinery were designed by Stephen Bourne, John Mashey
, and Dennis Ritchie
as a general mechanism to replace the earlier, more limited features. After the adoption of the Bourne shell as the standard shell in Version 7 Unix, use of the PWB shell was phased out, although for a while, there was an internal Bell Labs course called Bourne Shell Programming for Mashey Shell Programmers. (The C shell
, developed before the public release of the Bourne shell, also inherited some of the features of the PWB shell.)
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...
.
Distributed with some versions of Programmer's Workbench UNIX circa 1975-1977, it was a modified (and generally constrained to be upward-compatible) version of the Thompson shell
Thompson shell
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...
with additional features to increase usability for programming, and was maintained by 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...
and various others (Dick Haight, Alan Glasser).
Notable features
Although it was soon superseded by the Bourne shellBourne 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...
, several features introduced in the PWB shell remain in many later shells. The if and goto commands were made internal to the shell, and extended to allow if-then-else-endif, and switch
Switch statement
In computer programming, a switch, case, select or inspect statement is a type of selection control mechanism that exists in most imperative programming languages such as Pascal, Ada, C/C++, C#, Java, and so on. It is also included in several other types of languages...
and while
While loop
In most computer programming languages, a while loop is a control flow statement that allows code to be executed repeatedly based on a given boolean condition. The while loop can be thought of as a repeating if statement....
constructs were introduced, as well as onintr to ignore interrupts or catch them to perform cleanup.
Simple variables could be used, although their names were limited to one letter and some letters were reserved for special purposes, of which some are the precursors of the environment variables found in all Unix systems from Version 7
Version 7 Unix
Seventh Edition Unix, also called Version 7 Unix, Version 7 or just V7, was an important early release of the Unix operating system. V7, released in 1979, was the last Bell Laboratories release to see widespread distribution before the commercialization of Unix by AT&T in the early 1980s...
onward.
For example, The $s variable was the ancestor of $HOME, used to avoid hard-coding pathnames. The $p variable was the ancestor of $PATH, which let users search for commands in their own choice of directories. Unlike most of the UNIX systems of the time, the original PWB/UNIX computer center was shared by multiple programming groups who could not change the contents of /bin or /usr/bin, but wanted to create their own sets of shared commands. In addition, the shell's command-searching was enhanced to allow shell procedures to be invoked like binary commands, i.e., if the shell found a non-binary file marked executable, it would fork another shell instance to read that file as a shell script. Thus people could type command arguments rather than sh pathname/command arguments. All this behavior was packaged as the function pexec, which was the ancestor of execvp, to allow any program to invoke commands in the same way as the shell.
The $ character (sigil
Sigil (computer programming)
In computer programming, a sigil is a symbol attached to a variable name, showing the variable's datatype or scope. In 1999 Philip Gwyn adopted the term "to mean the funny character at the front of a Perl variable".- Historical context:...
), used previously for identifying arguments to a shell script
Shell script
A shell script is a script written for the shell, or command line interpreter, of an operating system. It is often considered a simple domain-specific programming language...
, became the marker for dereferencing a variable, and could be used to insert a variable's value into a string in double quotes
Quotation mark
Quotation marks or inverted commas are punctuation marks at the beginning and end of a quotation, direct speech, literal title or name. Quotation marks can also be used to indicate a different meaning of a word or phrase than the one typically associated with it and are often used to express irony...
. (In addition to later shells, this feature would also later appear in the Perl
Perl
Perl is a high-level, general-purpose, interpreted, dynamic programming language. Perl was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting language to make report processing easier. Since then, it has undergone many changes and revisions and become widely popular...
and PHP
PHP
PHP is a general-purpose server-side scripting language originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document...
programming languages.)
Descendants
These features could not overcome the shortcomings of the Thompson shell, and so a new shell was written from scratch by Stephen Bourne. This Bourne shellBourne 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...
was incompatible with the Thompson and PWB shells, but included equivalents of most of the PWB shell's features, but done from scratch, rather than incrementally, with much discussion among the various participants. In particular, Environment variables and related machinery were designed by Stephen Bourne, 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...
, and Dennis Ritchie
Dennis Ritchie
Dennis MacAlistair Ritchie , was an American computer scientist who "helped shape the digital era." He created the C programming language and, with long-time colleague Ken Thompson, the UNIX operating system...
as a general mechanism to replace the earlier, more limited features. After the adoption of the Bourne shell as the standard shell in Version 7 Unix, use of the PWB shell was phased out, although for a while, there was an internal Bell Labs course called Bourne Shell Programming for Mashey Shell Programmers. (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...
, developed before the public release of the Bourne shell, also inherited some of the features of the PWB shell.)