<tt><</tt>: Input Redirection



next up previous contents
Next: ;;;;;;: Standard Up: Input/Output Redirection Previous: Input/Output Redirection

<: Input Redirection

For commands expecting the input to come from the keyboard, < can be used to get the input from a file instead of having to type it in. A simple example is

cat < file
This will cause file to be displayed on the screen (the standard output). Note that it so happens that cat can take a filename as an input parameter, so
cat file
would result in the exact same response.

A more typical example is the use of a Fortran or C program (say prog) which takes data from the keyboard. If the user knows in advance what the data will be, the program could be run this way:

prog < data
where data contains the data to be read by the program.



Super-User
Fri Feb 17 15:55:40 EST 1995