Bourne | Ash |  #!  | find | ARG_MAX | Shells | whatshell | portability | permissions | UUOC | ancient | - | ../Various | HOME
"$@" | echo/printf | set -e | test | tty defs | tty chars | $() vs ) | IFS | using siginfo | nanosleep | line charset | locale

The Traditional Bourne Shell Family

History and Development

2001-10-07 .. 2019-09-16 (see recent changes)

This page is about all the variants of the original Bourne shell - it doesn't deal with bourne compatible shells like the korn (ksh), almquist (ash), bourne again (bash) or posix shell.

The Bourne shell, introduced with the "7th edition" of Unix in 1979, is an important part of the Unix history. Its grammar is the core of several modern shells. Even some later variants of the traditional Bourne shell are in use until today. However, there's little common knowledge about these traditional Bourne shell variants, because they never had been "versioned". This page tries to document their way.


1. Introduction
2. All the variants
3. Origins of the Bourne shell
4. Source Code
5. Running a Bourne shell
6. sbrk() bs SEGV

1. Introduction

Originally, this page started with a rough english translation of <> from Credits for that posting and for countless further comments to Gunnar Ritter. Without The Unix Heritage Society (TUHS) the early releases couldn't have been documented in detail here. Many thanks also to Dennis Ritchie for access to the Version 8 shell and to Warren Toomey (TUHS) concerning the SVR1 shell. I inspected the Bourne shell on these unix systems (credits included). If you can provide further information, I really would like to hear from you.

Find more information about the origins of the Bourne shell at the bottom of this page.

How to identify a traditional Bourne shell? 1 A simple check for an often undocumented but characteristic feature: You can use the circumflex ^ (caret) as replacement for | (pipe).
This was inherited from the predecessor, the Thompson shell, probably for reasons of convenience on early upper-case-only terminals.
See more common characteristics that are unique to traditional Bourne shells. 2

And how to identify the very version? As no version info has been compiled in 3, you have to test for specific features. Running the script whatshell helps to unravel the version. The script is a consequence of this page.

Thanks to the OpenSolaris project, Gunnar Ritter could publish a source port of a SVR4 variant of the Bourne shell. This was the first officially available later Bourne shell on free unix flavours.
Jörg Schilling has also published a port of the OpenSolaris variant and he has added numerous extensions.

Some issues are covered in more detail on subpages and linked inline below; here is a list of all these subpages.

Unsolved: Bourne shell before3 the well known 7th edition (~3 years of unreleased development). Better differentiate among SVR3.x and SVR4.2x.

  [1] Naturally, virtually all commercial systems provide a traditional Bourne shell. Meanwhile, you'll find it at a different path on some systems (e.g., HP-UX 10 ff., /usr/old/bin/sh) or under the different name bsh (e.g., on AIX 4 ff. and IRIX 6.4 ff.). On Ultrix you'll find a second variant as /bin/sh5. On OSF/1 there is the optional /usr/opt/svr4/usr/bin/sh. See also various system shells. No rule without exception: HP stopped including it with release "HP-UX 11i Version 1.5" (and Cray had stopped including it with "Unicos 9").

  [2] If you're interested in general script portability, then have a look at Paul Jarc's list of suspicious or nonportable constructs concerning modern portable script-writing.

  [3] The Version 7 variant contains a char* version = "\nVERSION sys137 DATE 1978 Nov 6 14:29:22\n".
However, it's not used, remains unchanged in the source in following releases and disappears with SVR2 (when the source is de-algol68ized).

2. All The Variants

A summary of the most important changes

      · Version 7   (1979)      control structures,  cmd substitution,  () and {},  arbitrary variable names,  trap,  eval,  special parameter substitutions, case
· System III (1981)       #,  [!...],  colon parameter substitution,  set --
· SVR1 (1983) shift n
· SVR2 (1984) functions,  built-ins: unset echo type,  redirection for builtins
· SVR3 (1986) modern "$@",   8-bit clean,   getopts,   functions do not modify positional parameters
· SVR4.0 (1989) job control
· SVR4.2 (1992) read -r

Table of contents

     · Version 7  (and 2.9BSD) and 3BSD and 4.xBSD (and Sinix 5.20 (ucb universe), SunOS 2) - Ultrix - Dynix 3.2 (ucb) - DomainOS 10.3
     · System III  (and Plexus 1.0) and SINIX 5.20 (sie)
     · SVR1 and Iris 3.7
     · SVR2  (and MV/UX 3) and Ultrix sh5 - Version 8 - SunOS 3 - OSF/1 - HP/UX - Dynix 3.2 (att)
     · SVR3  (and MUNIX V3, SINIX 5.20 (att), SCO Xenix 2.3.4) and SunOS 4 - AIX - IRIX 3/4 - SCO Unix - Interactive Unix - DG/UX 40 - DomainOS 10.3 - Dynix PTX
     · SVR4  (and OSF/1-SysV) and SunOS 5 - Heirloom - Schily - IRIX 5/6 - DG/UX 42 - EP/IX - Reliant UNIX
     · SVR4.2  (UnixWare, OpenUnix)

And now all the very details:

The item "Version 7" lists some important differences to its predecessors and successors.
All subsequent items list the differences to their predecessor as complete as possible.

3. Origins of the Bourne shell

Stephen Bourne's talk (at BSDCan 2015) "Early days of Unix and design of sh" (youtube) with both enlightening and entertaining background about his shell.

See an interview with Steve Bourne (link to the australian Computerworld, '09).

See an article from John Mashey in net.unix-wizards ('86). By the way, the PWB (aka Mashey) shell from the Programmer's Workbench, about "PWB 1.0", is also archived by TUHS (see PDP-11/Distributions/usdl/).

See also an article by David Korn ('94) with an interesting second chapter concerning the Bourne shell history. 17

[17] The article mentions that functions were added to the Bourne shell in 1982. In the above interview Bourne tells that this was finished in 1983. The next release, SVR2, was published 1984.

The Bourne shell would probably be in much wider interactive use today, if it provided line editing (and a history mechanism).
Having the above article in mind, this was - like with ksh originally - probably not done in the hope that these features would move into the terminal driver.
Kenneth Almquist even intentionally released his ash without line editing and history for this reasons.

Louis Pouzin explains how the concept and name of a "shell" was introduced in Multics in 1964/65.
He was inspired by Christopher Strachey's macro-generator (and its quoting and passing of arguments).
I don't know how much Bourne borrowed from this but it's an interesting connection to the re-parsing of expanded variables.


See manual pages of two main predecessors of the Bourne shell, the "Thompson" and the PWB shell:

See Jeffrey A. Neitzel's pages for both an enhanced, backward-compatible port of the Thompson shell and a port of the original source, which compiles on current systems.
As excellent illustration, you'll even find some example scripts there. For more details about Version 6, see also a V6 simh tape and an extensive V6 manual collection on Wolfgang Helbig's pages, or the software kit on the SIMH pages.

4. Source Code

Meanwhile the early Unix variants (research Unix until 7th ed and 32V) have become available in source under a BSD-like license from SCO/Caldera.
Have a look at TUHS, i.e., the archive mirror site list (for complete distributions), and the source code web interface (for a quick view at individual files).

For example the 7th edition source web interface is located here:, for System III here, for Ultrix-3.1 here (v7-derived) and here (svr2-derived).

You will not be able to easily compile earlier Bourne shells on a modern unix variant,
- because it is really oldfashioned C code with wild pointer management
- you cannot use libc because the shell internal memory management crashes malloc which is also used libc-internally
- additionally, the methods for directory access have changed

5. Running a Bourne shell

However, there are some other methods to get a running shell

Running a recent Bourne shell:

6. sbrk() vs. SEGV

I collected some enlightening notes from the usenet about the famous memory management implemented by means of trapping SIGSEGV and calling sbrk(2).

Some very informative details about the implementation are contained in Geoff Collyer's paper (see above), who rewrote the V7 sh memory management to run on later systems.


Sven Mascheck <>