Next: Pipe Up: The shell Previous: Standard input,output,error

Redirection

If you want to put a commands output to a file, all you have to do is redirecting it. The '>' '<' '>>' characters can be used for redirection. Each character has a special meaning.

The command below uses the "tmp" file as standard input, "dnm1" file as the standard output.
<mendelson:~>cat < tmp > dnm1
The contents of "tmp" file is fed to cat and outputs are written to "dnm1" file. If any errors occur, then the error messages would be written to standard error, so they will appear on the screen. Since cat writes the input to output line by line, after this command, "tmp" and "dnm1" files will have the same content. This is a way of copying files.

\begin{picture}
(300,110)
\put(35,70){Standard input}
\put(190,60){Standard}
\pu...
 ......}
\put(249,45){......}
\put(249,40){......}
\put(249,35){......}\end{picture}


Next: Pipe Up: The shell Previous: Standard input,output,error