Bird
0
0

Which of the following is TRUE about variable expansion inside a here document?

easy🧠 Conceptual Q2 of 15
Bash Scripting - Text Processing in Scripts
Which of the following is TRUE about variable expansion inside a here document?
AVariables are expanded only if the delimiter is unquoted
BVariables are always expanded regardless of delimiter quotes
CVariables are never expanded inside here documents
DVariables are expanded only if the delimiter is single quoted
Step-by-Step Solution
Solution:
  1. Step 1: Recall delimiter quoting effect

    If the delimiter is unquoted, variables inside the here document are expanded.
  2. Step 2: Effect of quoting delimiter

    If the delimiter is quoted (single or double quotes), variable expansion is disabled.
  3. Final Answer:

    Variables are expanded only if the delimiter is unquoted -> Option A
  4. Quick Check:

    Unquoted delimiter = variable expansion [OK]
Quick Trick: Use unquoted delimiter to expand variables inside here document [OK]
Common Mistakes:
MISTAKES
  • Assuming variables always expand
  • Quoting delimiter incorrectly
  • Confusing single and double quotes

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes