Table of Contents
Before reading this chapter, you should be familiar with basic Unix concepts (Chapter 1, Using Unix) and the Unix shell (Section 1.4.3, “Command Line Interfaces (CLIs): Unix Shells”).
A shell script is essentially a file containing a sequence of Unix commands. A script is a type of program, but is distinguished from other programs in that it represents programming at a higher level.
While a typical program is largely made of calls to subprograms, a script contains invocations of whole programs.
In other words, a script is a way of automating the execution of multiple separate programs in sequence.
The Unix command-line structure was designed to be convenient for both interactive use and for programming in scripts. Running a Unix command is much like calling a subprogram. The difference is just syntax. A subprogram call in C encloses the arguments in parenthesis and separates them with commas:
A Unix command is basically the same, except that it uses spaces instead of parenthesis and commas:
command_name arg1 arg2 arg3