Donation?

Harley Hahn
Home Page

Send a Message
to Harley


A Personal Note
from Harley Hahn

Unix Book
Home Page

SEARCH

List of Chapters

Table of Contents

List of Figures

Chapters...
   1   2   3
   4   5   6
   7   8   9
  10  11  12
  13  14  15
  16  17  18
  19  20  21
  22  23  24
  25  26

Glossary

Appendixes...
  A  B  C
  D  E  F
  G  H

Command
Summary...

• Alphabetical
• By category

Unix-Linux
Timeline

Internet
Resources

Errors and
Corrections

Endorsements


INSTRUCTOR
AND STUDENT
MATERIAL...

Home Page
& Overview

Exercises
& Answers

The Unix Model
Curriculum &
Course Outlines

PowerPoint Files
for Teachers

Exercises and Answers for Chapter 11...

The Shell

Review Question #1:

What is a shell?

Answer

A shell is a program that provides a primary interface to Unix by acting as a command processor and by interpreting shell scripts (a list of commands, stored in a file).

Review Question #2:

What are the two principal shell families? Name the most commonly used shells in each family.

Answer

Bourne Shell family: Bash, Korn Shell

C-Shell Family: Tcsh, C-Shell

Review Question #3:

What does "backwards compatible" mean?

Give an example of a shell that is backwards compatible with another shell.

Answer

"Backwards compatible" describes a program that supports the features of an older program.

The Tcsh is backwards compatible with the older C-Shell. Bash and the Korn Shell are backwards compatible with the older Bourne Shell.

Review Question #4:

What is POSIX? How is it pronounced?

Answer

POSIX is a project, started under the auspices of the IEEE (Institute of Electrical and Electronics Engineers) in the early 1990s, with the goal of standardizing Unix. Pronounced "pause-ix".

Review Question #5:

How do you change your shell temporarily? How do you change your shell permanently?

Answer

To change your shell temporarily, start a new shell by typing in its name. When you are finished, type ^D and return to the original shell.

To change your shell permanently, use the chsh program.

Applying Your Knowledge #1:

Check which shells are available on your system.

Display the name of your default shell.

Answer

Check which shells are available on your system:

less /etc/shells

Display the name of your default shell:

echo $SHELL

Applying Your Knowledge #2:

Change your default shell to another shell. Log out and log in again. Check to make sure your default shell has been changed.

Change your default shell back to what it was. Log out and log in again. Check to see that your default shell was changed back correctly.

Answer

Change your default shell to another shell:

chsh -s newshell

where newshell is full name of the shell to which you want to change. For example:

chsh -s /bin/tcsh

Press ^D to log out. Enter your userid and password to log in.

Check to make sure your default shell has been changed:

echo $SHELL

Change your default shell back to what it was:

chsh -s originalshell

where originalshell is the full name of your original shell. For example:

chsh -s /bin/bash

Press ^D to log out. Enter your userid and password to log in.

Check to make sure your default shell has been changed:

echo $SHELL

For Further Thought #1:

Over the years, many different Unix shells have been created. Why is this necessary? Why not just have one main shell that can be enhanced from time to time?

Answer

It was recognized a long time ago, that smart people had their own preferences as to how they choose to interact with a computer system and which tools they want to use to write scripts.

For this reason, the shell was designed to be a regular program, not a basic part of the operating system. This allowed people to use whichever shell they wanted; to switch from one to another as their needs changed and they gained more experience; and to design their own shell if they were so inclined.

Creating one main shell and insisting that it be used by all users would stifle individuality and innovation. It would also force the creation of an "official" body to standardize and maintain the shell. (Think about Microsoft's insistence that their Web browser Internet Explorer is part of the operating system.)

For Further Thought #2:

Program A has been replaced by program B. What are the advantages if program B is backwards compatible with program A? What are the disadvantages?

Answer

Advantages:

• Data used with old program will work with new program.

• People trained to use old program will not have to be retrained.

• It costs less to license an upgrade than to buy brand new software.

• The new program will have added features and bug fixes which (hopefully) make it better than the old program.

Disadvantages:

• The new program is locked into the design used for the old program, which stifles innovation.

• Sometimes it is better to spend the money and take the time to make a fresh start with new software than to stay with old software that is past its prime.

• Users who stay with a particular commercial software product, no matter what, are at the mercy of the vendor.

Jump to top of page