Miscellaneous

  Home arrow Miscellaneous arrow The Shell and UNIX
MISCELLANEOUS

The Shell and UNIX
By: Gabor Bernat
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 4
    2009-04-08

    Table of Contents:
  • The Shell and UNIX
  • Shell Programs
  • Shell Commands
  • Command execution

  •  
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement

    The Shell and UNIX


    (Page 1 of 4 )

    It is dangerous to expose our most important possessions directly to every little effect coming from the world. Somebody may take advantage and just do damage to them. It is wise to put something in front of them. In the case of an operating system, the most important part is the kernel. Furthermore, we can take advantage of putting something in front of it, simplify working with the kernel, and make a couple of checks to ensure that nothing abusive happens. What we add before the kernel is the Shell.

    This article, and a couple of the ones that follow, will show you how to use the shell to create scripts that will automate most of your work if you are an administrator. You may find some practical solutions for your home system also. In this first one, I will present the syntax of some general shell concepts. In later articles you will have the chance to learn a couple of the most important tools.

    The shell is at the same time an interactive command executer and a programming language. It is an interpreted script language. With this type of language, before we run the code we will not create machine code. This means no compilation, and if an error is found in the syntax, we will know when we reach that command. 

    An interpreter program will get the code itself and interpret it command by command. In our case, this program is the shell. The name "shell" is intuitive, as describes how it surrounds the kernel of the operating system and shields it from the outside. During the evolution of UNIX, multiple shells appeared. 

    The Bourne shell was the first one. In the early days, the programming language part was not so important; greater importance was placed on the execution of commands. You can find the binary code of this application inside the sh file. This was the first command interpreter designed to be a scripting language. The first creator of this was Stephen Bourne; all of this was done in 1977 at AT&T. Here was innovation, like the introduction of the number 2 for the standard error. 

    The second is the Korn Shell. Developed also at AT&T by David Korn, and in fact extended the Bourne Shell. Due to this, it remained backward compatible with the Bourne Shell. The POSIX description of the "Shell Language Standard" is maintained precisely and implements work with real numbers. Because of this, it is mainly used in the industry, and you can find it inside the binary file entitled ksh

    During the creation of BSD, Billy Joy created the C Shell. As it names tells us, its structure heavily resonates with the C programming language. You can find it inside the binary file with the name of csh; however, today we use a more modern counterpart that has the name of tcsh. You will use them mostly on BSD distributions.  

    The Bourne Again Shell is what we will use throughout our article series. Its developers made it open source initially and have maintained it as such to this day. It extends both Korn and Bash, and therefore most of the scripts in this article scripts will run on the Bash with no modification. On the modern UNIX distributions, these shells are set as defaults, and Bourne Again is probably the one that offers the most options when we talk about shell programming. 

    You can find out what shells are available in a system by viewing the /etc/shells file. As you can see from the picture below, we can have multiple shells available to us on the same operating system (this is on an Ubuntu 8.10 Linux distribution). You will find the default shell for the user in the /etc/passwd file.

     

     

    More Miscellaneous Articles
    More By Gabor Bernat

    blog comments powered by Disqus

    MISCELLANEOUS ARTICLES

    - Oracle Database XE: Indexes and Sequences
    - Modifying Tables in Oracle Database XE
    - Oracle Database XE: Tables and Constraints
    - More on Oracle Databases and Datatypes
    - Oracle Database XE Datatypes: Datetime and L...
    - Oracle Database XE Datatypes: Character and ...
    - From Databases to Datatypes
    - Firefox 3.6.6 Released with Improved Plug-in...
    - Attention Bloggers: WordPress 3.0 Now Releas...
    - Reflection in PHP 5
    - Inheritance and Other Advanced OOP Features
    - Advanced OOP Features
    - Linux from Scratch V.6.6 Review
    - Linux Gaining in Strength
    - Install Slackware on Your Old PC


    © 2003-2012 by Developer Shed. All rights reserved. DS Cluster 8 - Follow our Sitemap