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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

interpret - (hyphen) as the old working directory (equivalent to the tcsh shell<br />

variable owd). This is not a substitution at all, but an abbreviation recognized only<br />

by those commands. Nonetheless, it too can be prevented by quoting.<br />

<strong>Command</strong> execution<br />

The next three topics describe how the shell executes commands and deals with<br />

their input and output.<br />

Simple commands, pipelines, and sequences<br />

A simple command is a sequence of words, the first of which specifies the<br />

command to be executed. A series of simple commands joined by ’|’ characters<br />

forms a pipeline. The output of each command in a pipeline is connected to the<br />

input of the next.<br />

Simple commands and pipelines may be joined into sequences with ’;’, and will be<br />

executed sequentially. <strong>Command</strong>s and pipelines can also be joined into sequences<br />

with ’||’ or ’&&’, indicating, as in the C language, that the second is to be executed<br />

only if the first fails or succeeds respectively.<br />

A simple command, pipeline or sequence may be placed in parentheses, ’()’, to<br />

form a simple command, which may in turn be a component of a pipeline or<br />

sequence. A command, pipeline or sequence can be executed without waiting for it<br />

to terminate by following it with an ’&’.<br />

Built-in and non-built-in command execution<br />

tcsh Built-in commands are executed within the shell. If any component of a<br />

pipeline except the last is a built-in command, the pipeline is executed in a subshell.<br />

Parenthesized commands are always executed in a subshell:<br />

(cd; pwd); pwd<br />

which prints the home directory, leaving you where you were (printing this after the<br />

home directory), while<br />

cd; pwd<br />

leaves you in the home directory. Parenthesized commands are most often used to<br />

prevent cd from affecting the current shell.<br />

tcsh<br />

When a command to be executed is found not to be a built-in command the tcsh<br />

shell attempts to execute the command via execve. Each word in the variable path<br />

names a directory in which the tcsh shell will look for the command. If it is given<br />

neither a -c nor a -t option, the shell hashes the names in these directories into an<br />

internal table so that it will only try an execve in a directory if there is a possibility<br />

that the command resides there. This greatly speeds command location when a<br />

large number of directories are present in the search path. If this mechanism has<br />

been turned off (via unhash), if the shell was given a -c or -t argument or in any<br />

case for each directory component of path which does not begin with a /, the shell<br />

concatenates the current working directory with the given command name to form a<br />

pathname of a file which it then attempts to execute.<br />

If the file has execute permissions but is not an executable to the system (that is, it<br />

is neither an executable binary nor a script which specifies its interpreter), then it is<br />

assumed to be a file containing shell commands and a new shell is spawned to<br />

read it. The shell special alias may be set to specify an interpreter other than the<br />

shell itself.<br />

Chapter 2. Shell command descriptions 645

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

Saved successfully!

Ooh no, something went wrong!