Bird
0
0

What will be the output of this shell script?

medium📝 Command Output Q4 of 15
Bash Scripting - Basics
What will be the output of this shell script?
#!/bin/bash
echo "Start"
echo "End"
AStart\nEnd
BStart End
Cecho Start\necho End
DStart\n\nEnd
Step-by-Step Solution
Solution:
  1. Step 1: Understand echo command behavior

    Each echo prints its argument followed by a new line.
  2. Step 2: Predict output lines

    First echo prints "Start" then newline, second prints "End" then newline, so output is two lines: Start and End.
  3. Final Answer:

    Start\nEnd -> Option A
  4. Quick Check:

    Echo prints text with newline = Start\nEnd [OK]
Quick Trick: Each echo adds a new line automatically [OK]
Common Mistakes:
MISTAKES
  • Thinking echo prints on same line
  • Confusing echo with printing commands literally
  • Expecting extra blank lines

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes