heredoc
also: here document, here-document
A heredoc (here document) is a shell syntax that allows you to pass a multi-line string to a command without using quotes or escape characters. It begins with << followed by a delimiter and ends when that delimiter appears alone on a new line.
A heredoc provides a convenient way to input multiple lines of text directly in a script or shell session. Instead of concatenating strings or using escaped newlines, you simply mark the start with <<DELIMITER and the end with DELIMITER on its own line.
Common example:
cat <<EOF
Welcome to Linux
This is line two
EOF This sends three lines to cat, with EOF as the delimiter.Heredocs are especially useful in scripts for generating config files, sending email bodies, or creating documentation. Variables are expanded by default unless you quote the delimiter: <<'EOF' treats the content as literal text.