Go to the first, previous, next, last section, table of contents.
A command can have any of its input or output redirected by including an I/O directive. Each such directive is formed from an I/O word followed by a normal word and have meanings as described below. The leading n in the I/O word is an optional one or two digit number and, if present, specifies which I/O channel is being redirected. In each case, the second word is subjected to Variable, Arithmetic and Command substitution and, if a file name is expected, a limited form of Filename substitution in which the expansion must produce at most one file name or cause an error.
The I/O directives for any given command are processed in order so that if two directives attempt to redirect the same channel, the second one is effective.
---)
appears at the end of the I/O word, all leading tabs are stripped from the
lines as they are read, thus allowing indenting in shell scripts.
If any of the characters in the word are quoted, the here-file is passed
through unchanged.
Otherwise, dollar signs and back quotes which are not preceded by a slosh
cause Variable, Arithmetic, or Command substitution as appropriate.
<&
except that the default channel is 1.
---'
---'
Note that I/O redirection is done after pipes are set up, thus in the pipeline
prog1 2>&1 | prog2
the Standard Error as well as the Standard Output of
prog1
will be sent into the pipe to
prog2.
I/O directives for complex commands affect all sub-commands of that command unless, of course, the sub-command has an over-riding I/O directive.
Go to the first, previous, next, last section, table of contents.