|
Unix ---> Redirecting input and output |
|
A program that normally reads its input from the terminal (standard
input) or normally writes its output to the terminal (standard output)
may become annoying if you would rather send the input from a file instead
of the keyboard or send the output to a file instead of the terminal.
This annoyance can be avoided if you happen to be swift with the
redirection operators. The redirection operators are "<", ">",
and ">>". The first is used to send input to a command. The
second is used to create a file and send the output to it. The third
is used to append the output to an existing file.
An example of the first redirection operator was already given in
the Electronic Mail section. Suppose you wanted
to put a list of all the people logged on into a file called
neatguys with the current time listed at the top of the file.
date > neatguys
would create a file with the date and time in it, and
who >> neatguys
would append the list of users logged on.
Please notify owners of webpages with outdated links to these pages
|
|
Find this site useful? Want to give something back?
© 1993-2001 Christopher C. Taylor
|