Bird
0
0

Why does this script print an empty line?

hard🧠 Conceptual Q10 of 15
Bash Scripting - Variables
Why does this script print an empty line?
text=""
echo $text
AVariable text is not defined
BVariable text is assigned an empty string
Cecho command is incorrect
DQuotes around variable missing in echo
Step-by-Step Solution
Solution:
  1. Step 1: Check variable assignment

    The variable text is assigned an empty string "".
  2. Step 2: Understand echo output

    Printing an empty string results in an empty line output.
  3. Final Answer:

    Variable text is assigned an empty string -> Option B
  4. Quick Check:

    Empty string variable prints empty line [OK]
Quick Trick: Empty string variables print empty lines when echoed [OK]
Common Mistakes:
MISTAKES
  • Assuming variable is undefined
  • Thinking echo syntax is wrong
  • Forgetting quotes in assignment

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes