"/bin/sh from V6 UNIX" == "V6 Thompson sh(1)" == "V6 UNIX sh(1)"
Let's begin with 2 important bits of information before we get on with the story... =^)
- Sixth Edition UNIX == Version 6 (V6) UNIX - It was released in May 1975 ;
- Seventh Edition UNIX == Version 7 (V7) UNIX - It was released in 1979 ;
V7 UNIX & the shells
The Thompson shell, by Ken Thompson of Bell Labs, was distributed as the standard command interpreter, /bin/sh, through Version 6 (V6) UNIX. Then, in Version 7 (V7) UNIX, 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  in V7.
An updated version of the V6 Thompson shell was included, but its installation was incomplete. Specifically, there was no glob, if, or goto installed in V7 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. To be diplomatic though, I really can and do understand why.
In any case, I encourage you to read the memory management  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, shedding light so that we might better understand the story.
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 and tsh. The following Version 6 (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 .
The UNIX Time-Sharing System article gives the theory of operation of both the System and the Shell.
- Thompson shell source code - sh.c (installed as /bin/sh)
- Manuals - sh(I), chdir(I), login(I), newgrp(I), shift(I), wait(I)
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.
Original V6 Manuals & Source Code
I have also made these available here, in their original extracted form (w/ license & license files added), via original_v6_manuals and original_v6_source_code. The reason I've done so is simple for the manuals. You see, the manuals to which I've linked above have been modified so that they use the man(7) language. The originals, on the other hand, use ?roff as best I can remember, which doesn't work with any man program to which I have access. The source code is identical except that I didn't add the `NOTE:' comment about line counts/numbers and the other above-the-license comments that I typically add to stuff I'm working on (e.g., <file name> - a brief, 1 line description).
50 Years Of UNIX
Of course we are celebrating 50 Years of UNIX! \o/ ~~~ How could we not be? This, the Home page of the V6 Thompson Sh(ell) History website, is the 1 place where we can & do celebrate UNIX in a perpetual way; it's not 50 years we celebrate though; for me, it's the opportunity UNIX has given me to learn about it and its software via the Sixth Edition (V6) UNIX source code & documentation...
In my case today, it's 44 years of UNIX, from V6 onward... I would like to say "thank you" to the Research UNIX team (ken, dmr, and the unnamed team members & other folks).. It's because of you all that I'm still here and still learning.. Thanks again =^) See AUTHORS; its 1st paragraph defines the Research UNIX team, as I have come to appreciate it over the course of time.
Also, many thanks to Warren Toomey of TUHS for kindly answering when I asked him this question on Twitter: "When (?exactly|precisely?) is #50YearsofUNIX?? [...] "; his reply was: "ken wrote the PDP-7 version of #Unix in Jun/Jul '69. Have a read of " ..., with the following 2 links included in his tweet:
- Interview with Ken Thompson, 9-6-89; <- this link uses my local Unix Archive Mirror btw;
- Sven Mascheck, who maintains a website about the traditional Bourne shell family (including information about its origins), collected the referenced memory-management notes.
- 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.
- The Creation of the UNIX Operating System provides a very informative, and pleasant to read, account of the beginnings of the UNIX operating system.