The Bourne Shell

The Bourne shell is one of a number of Unix shells (C shell, Bash shell etc.). Like the others, it is both a command language and a programming language. (A shell is frequently called a command interpreter.) As a command language it provides a user interface to Unix/Linux. It executes commands entered by the user or from a file.

Files containing commands allow users build their own commands thus tailoring the system to their own needs. Such files are called: shell scripts, shell programs, or command files. These commands have access to the command line parameters and have the same status as other Unix commands.

As a programming language, each shell provides I/O, variables, conditionals, loops, and switches. The syntax is aimed at ease of use at a terminal so that strings for example do not have to be quoted. Each shell (Bourne, C, Bash etc) has its own syntax.

Shell programs are typically used to develop:
1)"User-friendly'' commands
2)System administration utilities
3)Application utilities

A common criticism of Unix or the shell in particular, is that it is unfriendly. Shell programs can be written to prompt the user for parameters, check them and so on, thus cushioning the user from the powerful shell, and making the system as user-friendly as required. Experienced users often get fed up of such prompting and usually prefer using the normal shell commands.
System administrators can build shell programs to add new users, to shutdown the system and so on. Some examples are given in these notes.

Finally useful applications can be developed with the shell e.g. a phone lookup system is briefly described. The development of applications often requires some knowledge of other Unix utilities such as grep, tr, ed and awk.

A knowledge of shell programming is essential for the serious Unix user, and will more than reward the few hours invested in exploring the shell, in time saved developing new commands and utilities.

0 comments:

Post a Comment

 
Top