|
Shell programmingLast revision August 6, 2004 This discussion applies to scripts written for the C-shell (csh). Bourne shell (sh) scripts are similar, although the exact syntax differs. A shell script is a file containing a set of commands to be executed (run) by the shell in sequence as it reads the file. In its simplest form, a shell script is simply a way to save a set of commands that are often executed, such as the initialization commands for your login session that are stored in the .login script file, so you don't have to re-type the set everytime you want to run it. Instead, you simply run the script that contains all the commands. Strictly speaking, everything that you can put into a shell script can also be executed interactively by typing on the command line, although the looping constructs can be cumbersome. This gives you the chance to test out the syntax of various shell constructs. The shell provides tools to make shell scripts more powerful, even full-fledged programs. Shell programming is organized around the concepts of "substitution" and "flow-of-control".
|