PWB shell

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


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]

The PWB shell was released with Version 5 Unix,[4] or in mid-1975 (sources differ),[5] and remained available through Version 6 Unix.[6] In Version 7 Unix (1979), the PWB shell was superseded by the Bourne shell.[7] The PWB shell was also incorporated into some versions of Programmer's Workbench UNIX, circa 1975–77.[1]

Notable features

Several features were 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.[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 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, 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.)


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.)

See also


  1. J. R. Mashey (1976-10-13). "Using a Command Language as a High-Level Programming Language". Proceedings of the 2nd International Conference on Software Engineering: 169–176. Cite journal requires |journal= (help)
  2. "Archived copy". Archived from the original on 2018-12-21. Retrieved 2018-12-31.CS1 maint: archived copy as title (link)
  3. Wiles, Jack (13 October 2011). "TechnoSecurity's Guide to E-Discovery and Digital Forensics: A Comprehensive Handbook". Elsevier. Retrieved 31 December 2018 via Google Books.
  4. "Archived copy". Archived from the original on 2018-12-31. Retrieved 2018-12-31.CS1 maint: archived copy as title (link)
  5. "Archived copy". Archived from the original on 2016-10-06. Retrieved 2018-12-31.CS1 maint: archived copy as title (link)
  6. "Archived copy". Archived from the original on 2018-12-31. Retrieved 2018-12-31.CS1 maint: archived copy as title (link)
  7. Iftekher, Mohammad Forhad. "Evolution Of Unix / Linux Shells - Unixmen". Retrieved 31 December 2018.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.