Write a multiline template directly to cat standard input.
Keep $USER literal rather than expanding the variable.
Which here-document opening is appropriate?
Quoting a here-document delimiter suppresses parameter expansion and command substitution in the body, so fixed text is passed unchanged.
Detailed explanation
cat << EOFIncorrect. An unquoted delimiter allows $USER expansion in the body.
cat < EOFIncorrect. This redirects a file named EOF as input.
cat <<< EOFIncorrect. <<< is a here-string for one string, not a multiline here-document.
cat <<'EOF'Correct. cat <<'EOF' keeps the body literal until the closing delimiter.
Try it yourself
An example you can run in a temporary verification environment.
USER=alice; cat <<'EOF'
hello $USER
EOFExpected result
hello $USERKey points
- << begins a here-document
- A quoted delimiter suppresses expansion
- < reads a file
Notes
- Environment: Bash 5.x / here-documentのみ
- Use temporary files and harmless commands for stream experiments.
- Shell redirection syntax and xargs behavior should be checked on the target shell implementation.
Foundation review
Place the operation
The delimiter's quoting controls whether the body is treated as literal text or expanded shell input.
Check the side effect
Keep the terminator at column zero and test with a harmless line reader.