Shell Programming

Calling this section “Shell Programming” is sort of misleading. Strictly speaking, any command that works with the shell can be part of a shell script. The commands are featured here because they are rarely used outside of a script.

The commands covered in this section deal primarily with the flow of control statements, for example, –if, case, while, and foreach. Also covered are statements such as eval, which deal with the evaluation of arguments.

First Line

By convention, UNIX shell scripts should all begin with a line like the following:

#!/bin/tcsh

The first two characters (#!) tell the operating system that the contents of this file are intended to be a shell script. The remaining characters are the absolute path of the ...

Get Linux® Desk Reference, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.