Here documents in bash scripting allow you to send multiple lines of text as input to a command. When the shell sees <<EOF, it starts reading the following lines until it finds a line with only EOF. These lines are then passed as input to the command before <<EOF. For example, 'cat <<EOF' followed by lines 'Hello' and 'World' and then 'EOF' will send 'Hello\nWorld' to cat, which prints them. The script stops reading input when it finds the EOF marker. If the EOF marker is missing, the shell waits forever. The lines inside the here document are not commands but plain text. You can change EOF to any word, but it must match exactly to end the input.