Miscellaneous
  Home arrow Miscellaneous arrow The Shell and UNIX
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Download TestComplete 
Forums Sitemap 
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MISCELLANEOUS

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

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

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    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


     

    MISCELLANEOUS ARTICLES

    - Using PHP to Stream MP3 Files and Prevent Il...
    - 10 Must Have Firefox Improvements
    - All About OpenOffice 3.0
    - Shell Script Writing
    - Loops in the UNIX Shell
    - The Test in the UNIX Shell
    - Data Streams and the UNIX Shell
    - Control Mechanisms of the UNIX Shell
    - Variables Within the UNIX Shell
    - The Shell and UNIX
    - In Detail: UNIX File Systems
    - Rights Management in UNIX
    - UNIX File Systems
    - The Terminal in UNIX
    - Operating Systems and UNIX





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    Stay green...Green IT