Open System Services Shell and Utilities Reference Manual (G06.27+, H06.04+)
User Commands (s) sh(1)
document.
<&digit The standard input is duplicated from file descriptor digit (see dup(2)). The standard
output is duplicated using >& digit.
<&- The standard input is closed. The standard output is closed using >&-.
<&p The input from the coprocess (or background process) is moved to standard input.
>&p The output to the coprocess is moved to standard output.
If one of the preceding redirections is preceded by a digit, then the file descriptor number referred
to is that specified by the digit (instead of the default 0 or 1). For example:
... 2>&1
means file descriptor 2 is to be opened for writing as a duplicate of file descriptor 1.
The order in which redirections are specified is significant. The shell evaluates each redirection
in terms of the (file descriptor, file) association at the time of evaluation. For example:
... 1>fname >&1
first associates file descriptor 1 with file fname. It then associates file descriptor 2 with the file
associated with file descriptor 1 (that is, fname). If the order of redirections is reversed, file
descriptor 2 is associated with the terminal (assuming file descriptor 1 is) and then file descriptor
1 is associated with file fname.
If a command is followed by & and job control is not active, the default standard input for the
command is the empty /dev/null file. Otherwise, the environment for the execution of a com-
mand contains the file descriptors of the invoking shell as modified by input/output
specifications.
Environment
The environment is a list of name-value pairs that is passed to an executed program in the same
way as a normal argument list. The names must be identifiers and the values are character
strings. The shell interacts with the environment in several ways. On invocation, the shell scans
the environment and creates a parameter for each name found, giving it the corresponding value
and marking it export. Executed commands inherit the environment. If you modify the values
of these parameters or create new ones, using the export or typeset -x commands, they become
part of the environment. The environment used by any executed command is thus composed of
any name-value pairs originally inherited by the shell, whose values can be modified by the
current shell, plus any additions that must be noted in the export or typeset -x commands.
You can augment the environment for any simple command or function by prefixing it with one
or more parameter assignments. A parameter assignment argument is a word of the form
identifier=value.
Thus, the following two expressions are equivalent (as far as the execution of command is con-
cerned):
TERM=450 command argument ...
(export TERM; TERM=450; command argument ...)
527188-004 Hewlett-Packard Company 8−27