Merge pull request #550 from dflamand/here-document

Expand on "here document"
This commit is contained in:
Joshua Levy 2018-04-07 13:21:59 -07:00 committed by GitHub
commit b81ac31ba1
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" allows [redirection of multiple lines of input](https://www.tldp.org/LDP/abs/html/here-docs.html) as if from a file:
```
cat <<EOF
input
on multiple lines
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`. - 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`.