Share on Facebook Share on Twitter Email
Answers.com

Bourne shell

 
Sci-Tech Dictionary: Bourne shell
(′bu̇rn ′shel)

(computer science) The original Unix shell.


Search unanswered questions...
Enter a question here...
Search: All sources Community Q&A Reference topics

The original command line processor for Unix. See C shell, Korn shell, bash shell and Unix.

Download Computer Desktop Encyclopedia to your iPhone/iTouch

Wikipedia: Bourne shell
Top

The Bourne shell, or sh, was the default Unix shell of Unix Version 7, and replaced the Thompson shell, whose executable file had the same name, sh. It was developed by Stephen Bourne, of AT&T Bell Laboratories, and was released in 1977 in the Version 7 Unix release distributed to colleges and universities. It remains a popular default shell for Unix accounts. The binary program of the Bourne shell or a compatible program is located at /bin/sh on most Unix systems, and is still the default shell for the root superuser on many current Unix implementations.

Contents

Origins

The shell was designed as a replacement for the original Thompson shell.

Among the primary goals were:

In March 2009 Computerworld published an in-depth interview with Steve Bourne The A-Z of Programming Languages: Bourne shell, or sh which details the Bourne Shell origins and design decisions.

Notable features

Features of the Bourne shell include:

  • scripts can be invoked as commands by using their filename
  • may be used interactively or non-interactively
  • allow both synchronous and asynchronous execution of commands
  • supports input and output redirection and pipelines
  • provides a set of builtin commands
  • provides flow control constructs, quotation facilities, and functions.
  • typeless variables
  • provides local and global variable scope
  • scripts do not require compilation before execution
  • does not have a goto facility, so code restructuring may be necessary
  • Command substitution using back quotes: `command`.
  • Here documents using << to embed a block of input text within a script.
  • "for ~ do ~ done" loops, in particular the use of $* to loop over arguments.
  • "case ~ in ~ esac" selection mechanism, primarily intended to assist argument parsing.
  • sh provided support for environment variables using keyword parameters and exportable variables.

Although it is used as an interactive command interpreter, it was always intended as a scripting language. It gained popularity with the publication of The UNIX Programming Environment by Brian W. Kernighan and Rob Pike. This was the first commercially published book that presented the shell as a programming language in a tutorial form.

The Bourne shell also was the first to feature the convention of using file descriptor 2> for error messages, allowing much greater programmatic control during scripting by keeping error messages separate from data.

Over the years, the Bourne shell was enhanced at AT&T. The various variants are thus called like the respective AT&T Unix version it was released with (some important variants being Version7, SystemIII, SVR2, SVR3, SVR4). As the shell was never versioned, the only way to identify it was testing its features.

Stephen Bourne carried into this shell some aspects of the ALGOL 68C compiler that he had been working on at Cambridge University. Notably he reused portions of ALGOL 68's "if ~ then ~ elif ~ else ~ fi", "case ~ in ~ out ~ esac" and "for ~ while ~ do ~ od" clauses in the common Unix Bourne shell syntax. Moreover - although the v7 shell is written in C - Bourne took advantage of some macros[1] to give the C source code an ALGOL 68 flavor. These macros (along with the finger command distributed in Unix version 4.2BSD) inspired the IOCCC - International Obfuscated C Code Contest[2].

Descendants

The Korn shell (ksh) written by David Korn, was a middle road between the Bourne shell and the C shell (which itself was derived from the Thompson shell). Its syntax was chiefly drawn from the Bourne shell, while its job control features resembled those of the C shell. The functionality of the original Korn Shell (known as ksh88 from the year of its introduction) was used as a basis for the POSIX shell standard. A newer version, ksh93, has been open source since 2000 and is used on some Linux distributions. There is also a clone of ksh88 known as pdksh, and this is the default shell for all users of OpenBSD.

rc was created at Bell Labs by Tom Duff as a replacement for sh for Version 10 Unix. It is the default shell for Plan 9 from Bell Labs. It has been ported to UNIX as part of Plan 9 from User Space.

Bash, also known as the Bourne-Again shell, was later developed for the GNU project and takes features from the Bourne shell, csh and ksh.

Due to copyright issues surrounding the Bourne Shell as it was used in historic CSRG BSD releases, Kenneth Almquist developed a clone of the Bourne Shell, known by some as the Almquist Shell and available under the BSD license, which is in use today on some BSD descendants and in low-memory situations. The Almquist Shell was ported to Linux, and the port renamed the Debian Almquist shell, or dash. This shell provides much faster execution of standard sh scripts with a smaller memory footprint than its more common counterpart, bash. Its use tends to expose bashisms - bash-centric assumptions made in scripts meant to run on sh.

Usage

The Bourne shell was once standard on all branded Unix systems, although historically BSD-based systems had many scripts written in csh. Bourne shell scripts can typically be run with bash or dash on GNU/Linux or other Unix-like systems.

Quotes

"Nobody really knows what the Bourne shell's grammar is. Even examination of the source code is little help."

Tom Duff [3]

See also

References

External links


 
 
Learn More
Korn shell (computer science)
C shell (technology)
shell (technology)

Who is mason bourne? Read answer...
What jacket does jason bourne wear in the bourne supremacy? Read answer...
What was the mobile phone jason bourne used in the bourne ultimatum? Read answer...

Help us answer these
What Constituency is Bourne in?
Who is Cody Bourn?
Who is jason bourne?

Post a question - any question - to the WikiAnswers community:

 

Copyrights:

Sci-Tech Dictionary. McGraw-Hill Dictionary of Scientific and Technical Terms. Copyright © 2003, 1994, 1989, 1984, 1978, 1976, 1974 by McGraw-Hill Companies, Inc. All rights reserved.  Read more
Computer Desktop Encyclopedia. THIS COPYRIGHTED DEFINITION IS FOR PERSONAL USE ONLY.
All other reproduction is strictly prohibited without permission from the publisher.
© 1981-2009 Computer Language Company Inc.  All rights reserved.  Read more
Wikipedia. This article is licensed under the Creative Commons Attribution/Share-Alike License. It uses material from the Wikipedia article "Bourne shell" Read more