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

The Traditional Bourne Shell Family

History and Development

2007-08-19 (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, 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 all these variants, because they never had been "versioned" -- this page tries to document their way.

Originally, this 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 documentation about the Version 8 shell and to Warren Toomey (TUHS) for documentation about the SVR1 shell.

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). See more common characteristics that are unique to traditional Bourne shells. 2

[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 OSF1 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.

Several subpages will be referred to concerning selected issues.

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.

Thanks to the OpenSolaris project, Gunnar Ritter could publish a source port of a SVR4 variant of the Bourne shell. This is the first officially available later Bourne shell on free unix flavours.

Todo: Bourne shell before Version 7 (unreleased), distinction between SVR3.0 and SVR3.2.

The Variants

· Version 7  (2.9BSD) and 3/4BSD - DomainOS 10.3
· System III  (Plexus 1.0) and SINIX
· SVR1
· SVR2  (Ultrix sh5, SunOS 3, MV/UX 3) and Version 8 - OSF/1 - HP/UX
· SVR3  (MUNIX V3, SINIX 5.20, XENIX 2.3.4) and SunOS 4 - AIX - IRIX 3/4 - SCO Unix - Interactive Unix - DG/UX 40 - DomainOS 10.3
· SVR4  (Reliant 5.42, OSF1-SysV) and SunOS 5 - IRIX 5/6 - DG/UX 42 - EP/IX - Reliant UNIX
· SVR4.2  (UnixWare, OpenUnix)

The item "Version 7" lists some important differences to its predecessors and successors.

All subsequent items try to list the differences to their predecessor as complete as possible.

Origins of the Bourne shell

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

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

[14] The article mentions that functions were added to the Bourne shell in 1982. This might have been internal work at that time or a typo in the article. SVR2 was actually released 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.


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

See Jeffrey A. Neitzel's pages for both an enhanced reimplementation 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.

sbrk() vs. SEGV

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

Source code

Meanwhile the early Unix variants have become available in source under a BSD-like license from SCO, have a look at TUHS. Usually you will not be able to easily compile earlier Bourne shells on a modern unix variant, as it is really oldfashioned C code with wild pointer management. Also, the internal memory management crashes malloc used in libc nowadays. And last but not least, directories are accessed differently. The source is also odd to read without preprocessing (e.g., it is made "algol-like" with preprocessor macros). Apart from just running Version 7 and its shell in an emulator like simh, you could also check the following:

Geoff Collyer provides a source package of the V7 shell which should compile on most POSIX systems. He has updated the memory management and directory-access code with parts from his V9 shell. However he has added a few minor modifications, so this variant is not completely original.
He has also published "a partial tour through the unix shell", which is quite helpful if you want to get busy with the source. It emphasizes the memory management but also contains general hints.

Thanks to the OpenSolaris project, Gunnar Ritter could publish a source port of a current Bourne shell. This is the first officially available later Bourne shell on free unix flavours.


Sven Mascheck <>