Here Document
noun
say it: “HEER DOK-yuh-ment” /ˈhɪr ˈdɑkjəmənt/
Several lines of text written right inside a script, up to a chosen end word, and handed to a command as its input.
What is a here document in bash?
A here document writes several lines of text in a script the way they'll look, and hands them to a command as its input. It starts with << and an end word, usually cat <<EOF, and stops at that word alone on a line. Variables inside it are filled in.
cat <<EOF
Usage: recipes [-q] [-c CATEGORY]
List the recipes in your recipe box.
EOF
# Usage: recipes [-q] [-c CATEGORY]
# List the recipes in your recipe box.
In a sentence
- “Variables inside a here document are filled in, like a string in double quotes.”
- “The recipes help page is a here document: cat <<EOF, the lines, then EOF.”
Level: Journeyman · More Unix terms at this level
Updated