Skip to content

Commit 01cb49f

Browse files
authored
Expand on "here document"
The here document description was poor, add a bit of detail, a small example, and a link for more information.
1 parent 666c7fe commit 01cb49f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,13 @@ Notes:
156156
}
157157
```
158158

159-
- Know about "here documents" in Bash, as in `cat <<EOF ...`.
159+
- 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:
160+
```
161+
cat << EOF
162+
These lines will
163+
print to stdout
164+
EOF
165+
```
160166

161167
- 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`.
162168

0 commit comments

Comments
 (0)