1.1 About /bin/sh

1.1 About /bin/sh

The shell is one of the most important parts of a Unix system. A shell is a program that runs commands. For example, one of the shell's duties is to run the commands that users type. Shells also serve as small programming environments. Unix programmers often break common tasks into little components and rely on the shell to manage tasks and to piece things together.

Many important parts of the system are actually shell scripts — text files that contain nothing but shell commands. If you have worked with MS-DOS, shell scripts may seem similar to .BAT files, but the shell is far more powerful. Chapter 7 is a small guide to shell scripts, and you can peruse it anytime after finishing this chapter.

As you progress through this book, you will learn how to manipulate commands with the shell. One of the best things about the shell is that if you make a mistake, you can look at what you typed, see what went wrong, and then try again quickly. Do not be afraid to try new things. The only way to learn the shell is to use it.

There are many different Unix shells, but all derive many of their features from the Bourne shell, or /bin/sh. Every Unix system needs the Bourne shell to function correctly, as you will see throughout this book.

Linux uses an enhanced version of this shell, called bash, or the "Bourne-again" shell. bash is the default shell for most Linux distributions, and /bin/sh is normally some sort of link to bash on a Linux system. You should use the bash shell when running the examples in this book.

You may not have bash if you're using this chapter as a guide for a Unix account at an organization where you are not the systems administrator. You can change your shell with chsh or ask your systems administrator for help.