Skip to main content
InterviewHubPRO
Section Overview
Q40

Question 40 of 50

Part 3: Advanced Text Processing & Production Internals (Senior / Lead)

80%
Bash & Shell Scripting (50 Qs)•Part 3: Advanced Text Processing & Production Internals (Senior / Lead)

Here Documents (`<<EOF`), Quoted Here Docs (`<<'EOF'`), and Here Strings (`<<<`).

senior LevelCode Examplebash-shellAdvanced Text Processing

In Simple Words:

  • Unquoted HereDoc (<<EOF): Evaluates variables ($VAR), command substitutions ($(date)), and arithmetic before feeding into stdin.
  • Quoted HereDoc (<<'EOF'): Treats all content as raw literal text without variable expansion. Essential when generating shell scripts, nginx configs, or remote SSH commands!
  • Here String (<<<): Feeds a single string variable directly into stdin without needing echo ... |:
bash
# Parsing single variable with read
read -r first last <<< "Linus Torvalds"
echo "Creator: $last, $first"