Bird
0
0

Identify the error in this script:

medium📝 Debug Q6 of 15
Bash Scripting - Basics
Identify the error in this script:
#!/bin/bash
echo "Start"
# !/bin/bash
echo "End"
AThe second line is an invalid shebang
BThere is no error; script runs fine
CThe comment line is incorrectly formatted
DThe script has two shebang lines which is not allowed
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the second line

    The line # !/bin/bash is a comment because it starts with #.
  2. Step 2: Confirm script behavior

    Comments do not affect execution; only the first shebang matters.
  3. Final Answer:

    There is no error; script runs fine -> Option B
  4. Quick Check:

    Commented shebang is ignored [OK]
Quick Trick: Lines starting with # are comments, not shebangs [OK]
Common Mistakes:
MISTAKES
  • Thinking commented shebang is active
  • Believing multiple shebangs cause error
  • Confusing comment syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes