What Is a Shell?

Team-Fly    

Solaris™ Operating Environment Boot Camp
By David Rhodes, Dominic Butler
Table of Contents
Chapter 5.  Shells


On a UNIX system, anyone wishing to log in and make use of anything other than an installed application will have to become familiar with using a shell. A shell is a program that sits between you (the user) and the UNIX kernel. You can tell the computer what to do by typing commands into the shell and it will run them for you. You can even write your own programs that can be run (interpreted) by the shell. These are generally called "shell scripts."

To make things difficult (or to make things easydepending on how you look at it), there are a number of shells to choose from. Some have similar features to others, some are very different, and some also have rather strange names.

Whichever shell you use, they all have some things in common:

  • You can type UNIX commands into them.

  • You can write your own shell scripts (although the syntax will be different in some shells).

  • You can define your own environment (again, this is done slightly differently in some shells).

When you first log in, a shell is started for you as part of the login procedure (see Chapter 3, "User Administration"). While you are logged in, the shell will continue running; when you log out, it stops. (For the pedants among us, it is actually the other way aroundwhile the shell is running, we are logged in; when we stop the shell, we are no longer logged in.)

The shell reads a line of input from your keyboard, executes the command(s) on that line, and then waits for the next line. It will keep doing this until it receives the end-of-file character (<ctrl-d>) or a logout command such as exit.

Most commands typed in will be operating system commands that live in various locations on the hard disk (see Chapter 6, "The Filesystem and Its Contents"), but some are actually part of the shell. An example of a command that is built into the shell is exit. No file is associated with this command; the shell knows that when you type it in, it should stop running. Each different shell has different built-in commands, which only adds to the confusion. The next section will attempt to give some guidance on which shell is the best one to use.


    Team-Fly    
    Top
     



    Solaris Operating Environment Boot Camp
    Solaris Operating Environment Boot Camp
    ISBN: 0130342874
    EAN: 2147483647
    Year: 2002
    Pages: 301

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net