music
OSdata.com: programming text book 

OSdata.com

choice of shells

summary

    This subchapter looks at the shells available for Linux and Unix.

    This includes an explanation of what a shell is and a list of the popular shells.

free book on Unix/Linux System Administration

Teach Yourself Unix/Linux System Administration and Shell Programming

free computer programming text book project

table of contents
If you like the idea of this project,
then please donate some money.
more information on donating

Google

shells

    This subchapter looks at the shells available for Linux and Unix.

what is a shell?

    Unix (and therefore also Mac OS X and Linux) has more than 200 basic commands (also called tools or utilities) that are distributed with the standard operating system. This collection and the ease with which they work together is the major source of the power of Unix. The vast majority of these standard tools are designed to be used from a command line (the shell).

    A shell is primarily a command interpreter.

    In a graphical user interface such as Macintosh or Windows, the user controls the computer and programs primarily through pointing and clicking, supplemented by some typing.

    In a shell, all of the commands are typed. The shell figures out the meaning of what you typed and then has the computer do as instructed.

    But the shell is much more than just a command interpreter. It is also a complete programming language.

    Because the shell is a complete programming language, with sequences, decisions, loops, and functions, it can do things well beyond pointing and clicking. It can take control of your computer and react to changing circumstances.

    Programming languages are used to make all of the computer programs and smart phone apps you’ve ever seen or used. Your imagination is the only limit on the power of the shell. Anything that can be done with a computer can be done with the shell.

    The term shell is derived from the idea of concentric layers that occur in many seashells. One view is that programs can be run inside of the shell, including other copies of the shell. These layers can be arbitrarily deep. An inverse view is that the kernel is the inner most layer, with the shell wrapped around the kernel and application programs wrapped around the shell.

choice of shells

    Most versions of Unix and Linux offer a choice of shells.

    The term shell comes from a concept of Unix being a series of layers of software that work together rather than one single monolithic operating system program. The command line shell was part of the outer shell of a series of programs that eventually reach down to the kernel or innermost portion of the operating system.

    Most shells are related to either the Bourne Shell or the C Shell.

    The default shell in Linux and MacOS X is normally BASH (Bourne Again SHell). This book assumes the use of BASH, but often mentions how things differ in other shells.

    It is possible to change the shell you are currently using (especially useful if you need to run a line or script from an alternative shell).

original shell

    The original shell, called the Thompson shell and abbreviated sh was written by Ken Thompson at AT&T’s Bell Labs, was very rudimentary. The Thompson shell was distributed with Versions 1 through 6 of Unix, from 1971 to 1975.

    Note that the same sh is also used for other shells, including the Bourne shell.

    The PWB shell or Mashey shell, abbreviated sh, was a variation of the Thompson shell that had been augmented by John Mashey and others at Bell Labs. The Mashey shell was distributed with the Prorgammer’s Workbench Unix in 1976.

Bourne shell

    Stephen Bourne created the Bourne shell, abbreviated sh, at AT&T’s Bell Labs in New Jersey as a scripting language.

    The Bourne shell was released in 1977 as the default shell in the Version 7 Unix release distributed to colleges and universities. It gained popularity with the publication of The UNIX Programming Environment by Brian W. Kernighan and Rob Pike. The book was the first commercially published tutorial on shell programming.

    The Bourne shell (or a shell that is compatible and will run Bourne shell scripts) is usually located at /bin/sh.

    You will also see references to the Bourne shell as bsh.

    The Bourne shell has a command language based on the ALGOL programming language, including process control, variables, regular expressions, flow control (decisions and loops), powerful input and output control, and functions.

    Despite its power, the original Bourne shell was difficult to use and lacked file name completion, command history, aliases, and had difficulty running multiple background jobs.

C shell

    The C shell, abbreviated csh, was created by Bill Joy, a graduate student at the University of California, Berkeley. With additional work by Michael Ubell, Eric Allman, Mike O’Brien, and Jim Kulp, it was released in the 2BSD release of BSD Unix in 1978.

    The C shell was based on the style of the C programming language.

    The C shell was much easier to use than the Bourne shell, but was unable to perform anything other than the most simple scripts.

    The C shell lacked functions, had weak input and output control, and had limited programming ability due to a poorly written command interpreter (Bill Joy explained that at the time he didn’t know about many standard compiler techniques).

    The power of the C shell for everyday interactive use was due to its introduction of command history, aliases, file name completion, and job control.

    It became common to use the C shell for everyday interactive computing and to use the Bourne shell for script programming.

    The improved C shell or TENEX C shell, abbreviated tcsh, was created by Ken Greer by Spetember 1975 and merged into the C shell in December 1983. Ken Greer based the shell on the TENEX operating system (hence, the “t” in tsch). Mike Ellis, Paul Placeway, and Christos Zoulas made major contributions to tcsh.

    The Hamilton C Shell was written in 1988 by Nicole Hamilton of Hamilton Laboratories for the OS/2 operating system. In 1992, the Hamilton C Shell was released for Windows NY. The OS/2 version was discontinued in 2003. The Windows version, with adaptations for Windows peculiarities, is still in use.

Korn shell

    The Korn shell, abbreviated ksh, was created by David Korn at AT&T’s Bell Labs and announced at USENIX on July 14, 1983. Mike Veach and Pat Sullivan were also early contributors.

    After years of Unix users having to learn two different shells, one for scripting and oen for interactive control, David Korn built the Korn shell by adding C shell features to the Bourne shell.

    In addition to adding command history, history substitution, aliases, and file name completion from the C shell, the Korn shell also included arrays and built-in integer arithmetic.

    The three major versions of the Korn shell are the official version ksh, the public domain version pdksh, and the desktop version dtksh

    CDE shipped with the Desktop version of the Korn shell.

    The POSIX shell is a variant of the Korn Shell. HP shipped the POSIX shell with HP-UX 11.0

BASH shell

    bash, which stands for Bourne Again SHell, was created by Brian Fox for the Free Software Foundation and first released on June 7, 1989.

    bash combined features from the Bourne shell, the C shell (both the original C shell and tcsh), and the Korn shell, while using the syntax of the original Bourne shell, allowing it to run almost all historical Bourne shell scripts. bash is now the primary shell in both Linux and Mac OS X.

    tt>bash introduced name completion for variable names, usernames, host names, and commands (in addition to file names), spelling correction for pathnames in the cd command, arrays of unlimited size, and integer arithmetic in any base from 2 to 64.

Z shell

    The Z shell, abbreviated zsh, was written by Paul Flastad in 1990 when he was a student at Princton University.

    The Z shell combines features of the Bourne Shell, the C shell, and bash.

other shells

    The POSIX shell, abbrevaited sh, (POSIX = Portable System Interface) is based on the Korn shell and is the official IEEE P1003.2 shell. It is the /bin/sh shell on some systems.

    The Almquist shell, abbreviated ash, was written by Keneth Almquist as a replacement for the Bourne shell written for BSD systems. The sh in FreeBSD and NetBSD were based on the Almquist shell.

    The Debian Almquist shell, abbreviated dash, is a modern replacement for the Almquist shell in Debian and Ubuntu Linux. While the default shell in both Debian and Ubuntu Linux are bash, /bin/sh is a symlink to ash.

    ash and dash are minimalist shells that interpret scripts and are not intended for interactive use. Their small size and fast execution time make them good for embedded systems. Because many scripts call for the use of /bin/sh, Debian and Ubuntu Unix gain speed of execution for scripts, while still allowing bash as the primary interactive shell.

    The Public domain Korn shell, abbreviated pdksh, is based on the Korn shell.

    The MirBSD Korm shell, abbreviated mksh, is based on the OpenBSD version of the Korn shell and the pdksh and was released as part of MirOS BSD.

    Busybox is a set of tiny utilities, including a version of ash, used in embedded systems.

    rc, written by Tom Duff, was the default shell for AT&T’s Bell Labs’ Plan 9 and Version 10 Unix. Plan 9 was an improved operating system based on Unix, but was not a significant enough improvement to overtake its predecessor. rc is available on some modern versions of Unix and Unix-like operating systems.

    es is an rc-compatible shell written in the mid-1990s for functional programming.

    Perl shell, abbreviated psh, is a shell that combines bash and the Perl scripting language. it is available for Unix-like and Windows operating systems.

    Friendly interactive shell, abbreviated fish, was released in 2005.

    pysh is a profile in the IPython project that combines a Unix-style shell with a Python scripting language shell.

    wish is a windowing shell for Tcl.Tk.

Which Shell to Use
from Google Shell Style Guide

    Bash is the only shell scripting language permitted for executables.

    Executables must start with #!/bin/bash and a minimum number of flags. Use set to set shell options so that calling your script as bash <script_name> does not break its functionality.

    Restricting all executable shell scripts to bash gives us a consistent shell language that’s installed on all our machines.

    The only exception to this is where you’re forced to by whatever you’re coding for. One example of this is Solaris SVR4 packages which require plain Bourne shell for any scripts.


comments, suggestions, corrections, criticisms

please contact us

your name:
email address:
phone number:
message:

free music player coding example

    Coding example: I am making heavily documented and explained open source code for a method to play music for free — almost any song, no subscription fees, no download costs, no advertisements, all completely legal. This is done by building a front-end to YouTube (which checks the copyright permissions for you).

    View music player in action: www.musicinpublic.com/.

    Create your own copy from the original source code/ (presented for learning programming).

This section is under the category of owning cirticism.

In response to a posting about my article collecting social media, Moderator +Andrew Smith (Technology addict, Web Developer, API guru, futsal and football wannabe, and all round nice guy!, Swordfox Design, arrowtown, new zealand) of the Google+ community Web Developers, Web Designers, Web Coding claims “Quite frankly this is self promotion, and your site is not of great quality. I can see how +Joost Schuur  would think this of not high enough a standard.”


return to table of contents
free downloadable college text book
free downloadable system administrator and shell programming book

view text book
HTML file

Because I no longer have the computer and software to make PDFs, the book is available as an HTML file, which you can convert into a PDF.

previous page next page
previous page next page

free book on Unix/Linux System Administration

Teach Yourself Unix/Linux System Administration and Shell Programming

free computer programming text book project

Building a free downloadable text book on computer programming for university, college, community college, and high school classes in computer programming.

If you like the idea of this project,
then please donate some money.

send donations to:
Milo
PO Box 1361
Tustin, California 92781

Supporting the entire project:

    If you have a business or organization that can support the entire cost of this project, please contact Pr Ntr Kmt (my church)

more information on donating

Some or all of the material on this web page appears in the
free downloadable college text book on computer programming.


Google


Made with Macintosh

    This web site handcrafted on Macintosh computers using Tom Bender’s Tex-Edit Plus and served using FreeBSD .

Viewable With Any Browser


    †UNIX used as a generic term unless specifically used as a trademark (such as in the phrase “UNIX certified”). UNIX is a registered trademark in the United States and other countries, licensed exclusively through X/Open Company Ltd.

    Names and logos of various OSs are trademarks of their respective owners.

    Copyright © 2010, 2012, 2014 Milo

    Separated from Shell basics on: August 23, 2012

    Last Updated: August 11, 2014


return to table of contents
free downloadable college text book
free downloadable system administrator and shell programming book

previous page next page
previous page next page