PWB shell

Last updated
Original author(s) John Mashey
Developer(s) AT&T Bell Laboratories
Operating system Unix
Available inEnglish
Type Unix shell

The PWB shell (also known as the Mashey shell) was a Unix shell. [1]

Contents

History

The PWB shell was a modified (and generally constrained to be upward-compatible) version of the Thompson shell with additional features to increase usability for programming. It was maintained by John Mashey and various others (Dick Haight, Alan Glasser). [1] [2] [3]

PWB/UNIX started with Research Unix 4th Edition in mid-October 1973, and was frequently updated over the next few years, as the PWB department tracked Research Unix changes and added a few features. The PWB shell was released in mid-1975 [4] and remained available through Version 6 Unix-based PWB/UNIX. [5] In Version 7 Unix (1979), the PWB shell was superseded by the Bourne shell. [6] The PWB shell was the standard shell for PWB/UNIX, circa 1975–78., [1] but did not run on any edition of Research Unix, as it required a new system call udata(2) that let login(1) set login name, login directory ($s) and TTY ($t) so sh(1) to obtain them.

Notable features

Several features were introduced in the PWB shell that 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. [1] 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 is the ancestor of $HOME, used to avoid hard-coding pathnames. The $p variable is 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 is the ancestor of execvp, to allow any program to invoke commands in the same way as the shell.

The $ character, 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.)

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 shell 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.[ citation needed ]

See also

Related Research Articles

<span class="mw-page-title-main">AWK</span> Programming language

AWK is a domain-specific language designed for text processing and typically used as a data extraction and reporting tool. Like sed and grep, it is a filter, and is a standard feature of most Unix-like operating systems.

<span class="mw-page-title-main">Bash (Unix shell)</span> GNU replacement for the Bourne shell

Bash is a Unix shell and command language written by Brian Fox for the GNU Project as a free software replacement for the Bourne shell. The shell's name is an acronym for Bourne-Again SHell, a pun on the name of the Bourne shell that it replaces and the notion of being "born again". First released in 1989, it has been used as the default login shell for most Linux distributions and it was one of the first programs Linus Torvalds ported to Linux, alongside GCC. It is available on nearly all modern operating systems.

<span class="mw-page-title-main">KornShell</span> Bourne shell backward compatible Unix shell created by David Korn

KornShell (ksh) is a Unix shell which was developed by David Korn at Bell Labs in the early 1980s and announced at USENIX on July 14, 1983. The initial development was based on Bourne shell source code. Other early contributors were Bell Labs developers Mike Veach and Pat Sullivan, who wrote the Emacs and vi-style line editing modes' code, respectively. KornShell is backward-compatible with the Bourne shell and includes many features of the C shell, inspired by the requests of Bell Labs users.

<span class="mw-page-title-main">Shell script</span> Script written for the shell, or command line interpreter, of an operating system

A shell script is a computer program designed to be run by a Unix shell, a command-line interpreter. The various dialects of shell scripts are considered to be scripting languages. Typical operations performed by shell scripts include file manipulation, program execution, and printing text. A script which sets up the environment, runs the program, and does any necessary cleanup or logging, is called a wrapper.

<span class="mw-page-title-main">Unix shell</span> Command-line interpreter for Unix operating system

A Unix shell is a command-line interpreter or shell that provides a command line user interface for Unix-like operating systems. The shell is both an interactive command language and a scripting language, and is used by the operating system to control the execution of the system using shell scripts.

<span class="mw-page-title-main">Bourne shell</span> Command-line interpreter for operating systems

The Bourne shell (sh) is a shell command-line interpreter for computer operating systems.

<span class="mw-page-title-main">C shell</span> Unix shell

The C shell is a Unix shell created by Bill Joy while he was a graduate student at University of California, Berkeley in the late 1970s. It has been widely distributed, beginning with the 2BSD release of the Berkeley Software Distribution (BSD) which Joy first distributed in 1978. Other early contributors to the ideas or the code were Michael Ubell, Eric Allman, Mike O'Brien and Jim Kulp.

<span class="mw-page-title-main">Z shell</span> Unix shell

The Z shell (Zsh) is a Unix shell that can be used as an interactive login shell and as a command interpreter for shell scripting. Zsh is an extended Bourne shell with many improvements, including some features of Bash, ksh, and tcsh.

Almquist shell is a lightweight Unix shell originally written by Kenneth Almquist in the late 1980s. Initially a clone of the System V.4 variant of the Bourne shell, it replaced the original Bourne shell in the BSD versions of Unix released in the early 1990s.

uname Standard UNIX utility that prints name and other details about the machine

uname is a computer program in Unix and Unix-like computer operating systems that prints the name, version and other details about the current machine and the operating system running on it.

An environment variable is a user-definable value that can affect the way running processes will behave on a computer. Environment variables are part of the environment in which a process runs. For example, a running process can query the value of the TEMP environment variable to discover a suitable location to store temporary files, or the HOME or USERPROFILE variable to find the directory structure owned by the user running the process.

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.

The Programmer's Workbench (PWB/UNIX) was an early, now discontinued, version of the Unix operating system that had been created in the Bell Labs Computer Science Research Group of AT&T. Its stated goal was to provide a time-sharing working environment for large groups of programmers, writing software for larger batch processing computers.

In computing, a shebang is the character sequence consisting of the characters number sign and exclamation mark at the beginning of a script. It is also called sharp-exclamation, sha-bang, hashbang, pound-bang, or hash-pling.

chsh is a command on Unix-like operating systems that is used to change a login shell. Users can either supply the pathname of the shell that they wish to change to on the command line, or supply no arguments, in which case chsh allows the user to change the shell interactively.

getopts is a built-in Unix shell command for parsing command-line arguments. It is designed to process command line arguments that follow the POSIX Utility Syntax Guidelines, based on the C interface of getopt.

The restricted shell is a Unix shell that restricts some of the capabilities available to an interactive user session, or to a shell script, running within it. It is intended to provide an additional layer of security, but is insufficient to allow execution of entirely untrusted software. A restricted mode operation is found in the original Bourne shell and its later counterpart Bash, and in the KornShell. In some cases a restricted shell is used in conjunction with a chroot jail, in a further attempt to limit access to the system as a whole.

In computing, command substitution is a facility that allows a command to be run and its output to be pasted back on the command line as arguments to another command. Command substitution first appeared in the Bourne shell, introduced with Version 7 Unix in 1979, and has remained a characteristic of all later Unix shells. The feature has since been adopted in other programming languages as well, including Perl, PHP, Ruby and Microsoft's Powershell under Windows. It also appears in Microsoft's CMD.EXE in the FOR command and the ( ) command.

<span class="mw-page-title-main">Command-line interface</span> Computer interface that uses text

A command-line interface (CLI) is a means of interacting with a computer program by inputting lines of text called command-lines. Command-line interfaces emerged in the mid-1960s, on computer terminals, as an interactive and more user-friendly alternative to the non-interactive interface available with punched cards.

bs is a programming language and a compiler/interpreter for modest-sized programs on UNIX systems. The bs command can be invoked either for interactive programming or with a file containing a program, optionally taking arguments, via a Unix shell, e.g., using a Shebang (Unix) #!/usr/bin/bs.

References

  1. 1 2 3 4 Mashey, John R. (1976-10-13). "Using a Command Language as a High-Level Programming Language". San Francisco, California, USA: Proceedings of the 2nd International Conference on Software Engineering. pp. 169–176. Archived from the original on 12 April 2020. Retrieved 12 April 2020. In addition to these variables [$n, $p, $r, $s, and $t], the following is provided: $$ contains a 5-digit number that is the unique process number of the current shell. In some circumstances, it is necessary to know the number of a process, in order to kill it, for example. However, its most common use to date has been that of generating unique names for temporary files.
  2. Likic, Vladimir (28 September 2018). "Understanding Bash: Elements of Programming". Linux Journal. Archived from the original on 2018-12-21. Retrieved 2018-12-31. The original Thompson shell, the Mashey shell and the Bourne shell were all called sh, and they overlapped or replaced one another in the years 1970–1976 as they were refined and gained additional capabilities. ... The Thompson shell had no programming capabilities. This changed with the development of the Mashey shell (and later the Bourne shell).
  3. Wiles, Jack (13 October 2011). TechnoSecurity's Guide to E-Discovery and Digital Forensics: A Comprehensive Handbook. Elsevier. ISBN   9780080558813 . Retrieved 31 December 2018 via Google Books.
  4. Mashey, John R. (27 January 1999) [1986]. Toomey, Warren (ed.). "Re: Shell history, true facts, but long | Newsgroups: net.unix-wizards". Archived from the original on 2016-10-06. Retrieved 2018-12-31. The "PWB Shell" first appeared in mid-1975. It derived from a set of requirements and suggestions from me in early 1975 in trying to do serious shell programming. In mid-1975, the shell acquired variables, including 3 that were derived from per-process data. This is where the idea of more generalised path- searching came in.
  5. Chorafas, Dimitris N. (1986). Which Unix? : AT&T, IBM, and other standard bearers. McGraw-Hill. ISBN   9780070108790. Archived from the original on 2018-12-31. Retrieved 2018-12-31.
  6. Iftekher, Mohammad Forhad (10 November 2015). "Evolution Of Unix / Linux Shells - Unixmen". Unixmen.com. Archived from the original on 21 July 2019. Retrieved 31 December 2018.