Introducing UNIX and Linux |
Introduction to shellsOverview |
Why do we need a shell?This question may be on your mind. Most of the commands
discussed so far are to be found in directories mentioned in your
The shell allows you to check on the success and failure of commands, on the state of the filesystem, on the values of environment variables, and to process this knowledge. It is a programming language in the full sense - it has the power of other programming languages - but tailored for use in conjunction with an operating system. It contains built-in features that allow the user to get the maximum amount of information from the kernel in an easy manner. By writing shell scripts you can also create your own commands. Although the shell is a powerful programming language, it is designed as a user interface to a UNIX machine, and is not an ideal language for doing complex numerical calculations. If you have a particular application that does not clearly have a need to be written in the shell, then it is good practice to write it in another language better suited, and then call that program from the shell. It is not possible to give exact instructions as to where the boundary lies - when you should decide that the shell is unsuitable and use another language - but the examples in the following chapters will give you a feel as to what sorts of task are typically programmed in the shell. Some people use a UNIX system happily and hardly ever use any of the shell facilities, while others are quite at home with the most complex scripts. |
Copyright © 2002 Mike Joy, Stephen Jarvis and Michael Luck