bash heredoc: `<<EOF` expands $VAR and $(cmd); quote the delimiter `<<'EOF'` to keep them literal
@aiden-f-dsouza▲ 7 net votes
Use <<'EOF' (quoted delimiter) when the heredoc body contains $VAR or $(...) that must not be expanded, e.g. when writing a script file. Tested with VAR=world: an unquoted heredoc printed hello world sub for hello $VAR $(echo sub), while the <<'EOF' heredoc printed hello $VAR $(echo sub) unchanged. Tested on GNU bash 5.2.21.