16.12.2012 Views

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

used to introduce parser metasyntax. For example, alias print ’pr \!* | lpr’ defines a<br />

command (print) which prints its arguments to the line printer.<br />

Alias substitution is repeated until the first word of the command has no alias. If an<br />

alias substitution does not change the first word (as in the previous example) it is<br />

flagged to prevent a loop. Other loops are detected and cause an error.<br />

Some aliases are referred to by the shell; see “tcsh built-in commands” on page<br />

653.<br />

Variable substitution<br />

The tcsh shell maintains a list of variables, each of which has as value a list of zero<br />

or more words. The values of tcsh shell variables can be displayed and changed<br />

with the set and unset commands. The system maintains its own list of<br />

″environment″ variables. These can be displayed and changed with printenv,<br />

setenv and unsetenv.<br />

Variables may be made read-only with set -r. Read-only variables may not be<br />

modified or unset; attempting to do so will cause an error. Once made read-only, a<br />

variable cannot be made writable, so set -r should be used with caution.<br />

Environment variables cannot be made read-only.<br />

Some variables are set by the tcsh shell or referred to by it. For instance, the argv<br />

variable is an image of the shell’s argument list, and words of this variable’s value<br />

are referred to in special ways. Some of the variables referred to by the tcsh shell<br />

are toggles; the shell does not care what their value is, only whether they are set or<br />

not. For instance, the verbose variable is a toggle which causes command input to<br />

be echoed. The -v command line option sets this variable. Special shell variables<br />

lists all variables which are referred to by the shell.<br />

Other operations treat variables numerically. The @ (at) command permits numeric<br />

calculations to be performed and the result assigned to a variable. Variable values<br />

are, however, always represented as (zero or more) strings. For the purposes of<br />

numeric operations, the null string is considered to be zero, and the second and<br />

subsequent words of multiword values are ignored.<br />

After the input line is aliased and parsed, and before each command is executed,<br />

variable substitution is performed keyed by $ characters. This expansion can be<br />

prevented by preceding the $ with a \ except within double quotes (″) where it<br />

always occurs, and within single quotes ( ’ ) where it never occurs. Strings quoted<br />

by backward quotes or accents (`) are interpreted later (see “<strong>Command</strong> substitution”<br />

on page 643) so $ substitution does not occur there until later, if at all. A $ is<br />

passed unchanged if followed by a blank, tab, or end-of-line.<br />

Input/output redirections are recognized before variable expansion, and are variable<br />

expanded separately. Otherwise, the command name and entire argument list are<br />

expanded together. It is thus possible for the first (command) word (to this point) to<br />

generate more than one word, the first of which becomes the command name, and<br />

the rest of which become arguments.<br />

Unless enclosed in double quotes (″) or given the :q modifier the results of variable<br />

substitution may eventually be command and filename substituted. Within ″, a<br />

variable whose value consists of multiple words expands to a (portion of a) single<br />

word, with the words of the variable’s value separated by blanks. When the :q<br />

tcsh<br />

Chapter 2. Shell command descriptions 641

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!