Expand on "here document"

The here document description was poor, add a bit of detail, a small example, and a link for more information.
This commit is contained in:
Dillon Flamand 2018-03-31 22:30:06 -07:00 committed by GitHub
parent 666c7fee18
commit 01cb49ff90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -156,7 +156,13 @@ Notes:
}
```
- Know about "here documents" in Bash, as in `cat <<EOF ...`.
- A "here document" is a code structure that is treated as if it were a separate file. They can be used to feed multiple lines into a command. Consider reading more about ["here documents"](https://www.tldp.org/LDP/abs/html/here-docs.html). A simple example is:
```
cat << EOF
These lines will
print to stdout
EOF
```
- In Bash, redirect both standard output and standard error via: `some-command >logfile 2>&1` or `some-command &>logfile`. Often, to ensure a command does not leave an open file handle to standard input, tying it to the terminal you are in, it is also good practice to add `</dev/null`.