< |
Redirects input to a specified file. |
Redirecting input from a file. |
> |
Redirects output to a specified file. |
Redirecting command output to a file. |
>> |
Redirects output to be appended to
the end of the specified file. |
Redirecting command output to a file. |
>& |
Redirects stdout and stderr. |
Redirecting error output to a file. |
<<text |
Reads standard input until it encounters text. |
This is used in what is called a
“here-document.” Input is usually typed on the screen or in
a shell script. For example, this script creates a file called hello.c, compiles it into hello,
and then executes it:
# create program
cat > hello.c << EOF
main() {
puts("Hello, World!\n");
}
EOF
# compile program
c89 -o hello hello.c
#execute program
hello
When you run the shell script, it runs the cat > hello.c command
using the input between the two End_of_File strings. |