Bird
0
0

Which command is used to make a bash script executable before running it?

easy🧠 Conceptual Q1 of 15
Bash Scripting - Basics
Which command is used to make a bash script executable before running it?
Abash -x script.sh
Brun script.sh
Cexecute script.sh
Dchmod +x script.sh
Step-by-Step Solution
Solution:
  1. Step 1: Understand file permissions in Linux

    To run a script directly, it must have execute permission.
  2. Step 2: Use chmod to add execute permission

    The command chmod +x script.sh adds execute permission to the script.
  3. Final Answer:

    chmod +x script.sh -> Option D
  4. Quick Check:

    Make script executable = chmod +x [OK]
Quick Trick: Use chmod +x to make scripts executable before running [OK]
Common Mistakes:
MISTAKES
  • Trying to run script without execute permission
  • Using 'run' or 'execute' commands which don't exist
  • Confusing bash -x (debug mode) with execution permission

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes