Bird
0
0

Which line should you add at the very top of a bash script file to specify the interpreter?

easy📝 Syntax Q12 of 15
Bash Scripting - Basics
Which line should you add at the very top of a bash script file to specify the interpreter?
A#!/bin/python
B#!/bin/bash
C#!/usr/bin/node
D#!/bin/shutdown
Step-by-Step Solution
Solution:
  1. Step 1: Identify the correct shebang for bash scripts

    The shebang line tells the system which program runs the script. For bash, it is #!/bin/bash.
  2. Step 2: Eliminate incorrect interpreters

    Options A, C, and D point to other interpreters or invalid commands.
  3. Final Answer:

    #!/bin/bash -> Option B
  4. Quick Check:

    Shebang for bash = #!/bin/bash [OK]
Quick Trick: Use #!/bin/bash as first line to run bash scripts [OK]
Common Mistakes:
MISTAKES
  • Using wrong interpreter path
  • Forgetting the #! at the start
  • Confusing bash with other languages

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes