[ Previous | Next | Table of Contents | Index | Library Home |
Legal |
Search ]
System User's Guide: Operating System and Devices
In general, most commands do not
know or care whether their input or output is associated with the keyboard,
the display screen, or a file. Thus, a command can be used conveniently
either at the keyboard or in a pipeline.
The following redirection options
can appear anywhere in a simple command. They can also precede or
follow a command, but are not passed to the command.
<File
| Uses the specified file as standard input.
|
>File
| Uses the specified file as standard output. Creates the file if it
does not exist; otherwise, truncates it to zero length.
|
> >File
| Uses the specified file as standard output. Creates the file if it
does not exist; otherwise, adds the output to the end of the file.
|
<<[-]eofstr
| Reads as standard input all lines from the eofstr variable up
to a line containing only eofstr or up to an end-of-file
character. If any character in the eofstr variable is
quoted, the shell does not expand or interpret any characters in the input
lines. Otherwise, it performs variable and command substitution and
ignores a quoted new-line character (\new-line). Use a \ to
quote characters within the eofstr variable or within the input
lines.
If you add a - to the <<
redirection option, then all leading tabs are stripped from the
eofstr variable and from the input lines.
|
<&Digit
| Associates standard input with the file descriptor specified by the
Digit variable.
|
>&Digit
| Associates standard output with the file descriptor specified by the
Digit variable.
|
<&-
| Closes standard input.
|
>&-
| Closes standard output.
|
Note: The
restricted shell does not allow output redirection.
For more information about
redirection, see Chapter 4, Input and Output Redirection and Bourne Shell Related Information.
[ Previous | Next | Table of Contents | Index |
Library Home |
Legal |
Search ]