Creating Shell Scripts in the C shell

 


Overview

Most of the commands that can be issued are the names of individual programs, originally written in the C programming language and provided in executable (compiled) form. A combination of these commands can be placed in files and are referred to as scripts. The shell is able to process these scripts in the same way as if they had been typed at the keyboard. In addition, the shell provides variables and program structures such as loops.

All csh scripts should begin with a #, otherwise a Bourne shell will be invoked. It is possible to state explicitly which executable (i.e. which shell) should execute a script by placing ! program name directly after the #, for example #! /bin/sh would load a Bourne shell, #! /bin/csh would load a csh.