Description - V7 UNIX & the shells

The Thompson shell, by Ken Thompson of Bell Labs, was distributed as the standard command interpreter, /bin/sh, through Sixth Edition (V6) UNIX. Then, in the Seventh Edition (V7), it was replaced by the Bourne shell. However, the Thompson shell was still distributed with the system as osh (see osh.c) because of known portability problems with the Bourne shell's memory management [1] in Seventh Edition (V7) UNIX.

Another thing that troubled me somewhat over the years was the following... An updated version of the V6 Thompson shell was included, but its installation was incomplete. Meaning, there was no glob, if, or goto installed in V7 UNIX for the installed osh to use. That said, the included Thompson shell itself would have been enough to help fix things up on a bad Bourne shell day. Still, a shell I like (Thompson) was being replaced by one I don't (Bourne), and that's no fun for me, but it's really all fine and makes a certain amount of sense in the end.

In any case, I encourage you to read the memory management [1] page (linked to above) if you never have and/or to reread it if you already have. It's that important, and Dennis (dmr) sums up the Bourne shell's memory management / portability problems very nicely as well.

V6 UNIX & Ken's shell

Since it is not possible to appreciate the true nature of Ken Thompson's shell without having access to the original source code and documentation, this material is provided here under the following Caldera license (pdf) (local copy (pdf)) as a historical reference for the development of etsh. The following Sixth Edition (V6) UNIX source code and documentation was obtained from The UNIX Heritage Society (TUHS, see Dennis_v6). According to the details, these files were provided to TUHS by Dennis Ritchie [2].

The UNIX Time-Sharing System article gives the theory of operation of both the System and the Shell.

The shell made use of the following external utilities.

  • The exit(I) command, exit.c (installed as /bin/exit), was used to terminate command files.
  • The goto(I) command, goto.c (installed as /bin/goto), was used to transfer the shell's control from one point to another within a command file.
  • The if(I) command, if.c (installed as /bin/if), was used to evaluate conditional expressions. This is the predecessor of test(1), which was first released in Seventh Edition UNIX.
  • The glob(VIII) command, glob.c (installed as /etc/glob), was used to expand `*', `?', and `[...]' in command arguments.

See also

  1. Sven Mascheck, who maintains a website about the traditional Bourne shell family (including information about its origins), collected the referenced memory-management notes.
  2. Before his untimely passing, Dennis M. Ritchie maintained a great deal of important historical information about the early versions of the UNIX operating system on his Dennis Ritchie Home Page. It also includes some information about the shell.
  3. The Creation of the UNIX Operating System provides a very informative, and pleasant to read, account of the beginnings of the UNIX operating system.