Redirecting input streams |
|
Unless you specify otherwise, many Unix commands take their input
from the keyboard. For example, the cat command usually
takes input from the keyboard and sends it to the display screen:
yourname@yourcomputer<26>% cat
Foo.
Foo.
Bar!
Bar!
^D
In the above example, user input is shown in bold type. Note that
every time you type a line, the line is typed back at you. Use the
control-D character to terminate
your input; this character is shown as ^D on your screen.
To redirect the input stream of a command means to execute it so
that the command reads its input from a given file.
To use input redirection, type a ``less-than'' character
(<) at the end of the command,
and then type the name of the file you want to use for input.
For example:
yourname@yourcomputer<27>% cat <timestamp
Sat Jan 28 15:03:08 MST 1995
|
John Shipman, john@nmt.edu
Last updated: 1995/12/04 19:39:34 UT URL: http://www.nmt.edu/tcc/help/unix/inredirect.html |
|