UNIX for OpenVMS Users, Second Edition


Civilization advances by extending the number of important operations that can be performed without thinking of them.
Alfred North Whitehead
Shell programming involves grouping together a number of shell commands and constructs into a file (called a shell script) to perform a routine task. The analogy in OpenVMS is the creation of a Digital Command Language (DCL) command procedure. If you are versed in DCL command procedures, you should be aware that achieving equivalent functionality in UNIX requires becoming adept at writing shell scripts. The syntax of a shell script varies according to the shell in use; in this chapter, we will give examples of both C shell and Korn shell syntax. Since the man pages for csh (C shell) and ksh (Korn shell) are terse, this chapter explains a few features of shell programming in greater detail. For more than the basics though, you should invest in a book dedicated to the shell you plan to use. The following comparisons and contrasts will help to orient the OpenVMS user to shell programming in UNIX.
Both shell scripts and DCL command procedures use only commands and constructs that the standard operating system can interpret. Use of a high-level language compiler is not necessary.
As a general rule, shell scripts execute faster than DCL command procedures.
The debugging of scripts and DCL command procedures relies on the error-reporting features of the shell and command language interpreter, respectively. Error reporting by the shell is uninformative.
DCL command...