MPE/iX Shell and Utilities Reference Manual, Vol 2
sh(1) MPE/iX Shell and Utilities sh(1)
command && command
command || command
command & command
command &
command |&
command ; command
command ;
command <newline>
The following table gives the order of precedence of the preceding operators. Highest priority
operators are listed first and operators on the same line have equal priority.
()
|
&& ||
& |& ; <newline>
The meaning of these operations is as follows:
(command)
executes command in a subshell. This means that the current shell invokes a second
shell, and this second shell actually executes command. In this way, command exe-
cutes in a completely separate execution environment; it can change working direc-
tories, change variables, open files, and so on without affecting the first shell. The
subshell’s environment begins as a copy of the current environment, so the value of
the
ENV
environment variable is not run when a subshell starts.
| creates a pipe between the two commands that the | operator connects. This means
that the standard output of the first command becomes the standard input of the sec-
ond command. A series of commands connected by pipes is called a pipeline. The
exit status is that of the last command in the pipeline.
&& is the logical AND operator. The shell executes the second command if and only if
the first command returns a true (zero) exit status.
|| This is the logical OR operator. The shell executes the second command if and only
if the first command returns a false (non-zero) exit status.
& executes the command that precedes it asynchronously. This means that the shell just
starts the command running and then immediately goes on take new input, before the
command finishes execution. On systems where asynchronous execution is not pos-
sible, this operation is effectively equivalent to ;.
1-522 Commands and Utilities