Bird
0
0

Which of the following is the correct shebang line to run a script with Zsh?

easy📝 Syntax Q3 of 15
Bash Scripting - Basics
Which of the following is the correct shebang line to run a script with Zsh?
A#!/bin/bash
B#!/bin/sh
C#!/usr/bin/fish
D#!/usr/bin/env zsh
Step-by-Step Solution
Solution:
  1. Step 1: Understand shebang purpose

    Shebang specifies which shell runs the script.
  2. Step 2: Identify correct path for Zsh

    Using /usr/bin/env zsh is portable and correct for Zsh scripts.
  3. Final Answer:

    #!/usr/bin/env zsh -> Option D
  4. Quick Check:

    Correct Zsh shebang = #!/usr/bin/env zsh [OK]
Quick Trick: Use /usr/bin/env for portable shebangs [OK]
Common Mistakes:
MISTAKES
  • Using bash shebang for Zsh scripts
  • Using sh shebang for Zsh
  • Incorrect path for fish shell

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes