Shell Redirection
Contents
Redirections
To redirect a file's contents into a command, try:
: </path/to/file
To redirect a command's STDOUT into a file, try:
: >/path/to/file
If the noclobber shell option is enabled, use >| instead to force overwriting.
Use >> instead to append to a file, as opposed to overwriting.
For details on redirecting with file descriptors, including STDOUT and STDERR, see here.
Here Documents
A here document is an anonymous and transient file that is redirected into a command.
echo <<EOF line one line two line four EOF
To indent the here document with tab characters, use <<-EOF.
Word splitting and filename expansion do not apply to here documents. To prevent those from being applied, quote the marker (i.e. "EOF")
Note that the here document marker can be anything, but the common convention is to use EOF.