Bird
0
0

You want to execute install.sh located in /opt/tools from any directory without typing the full path. What is the best method?

hard🚀 Application Q8 of 15
Bash Scripting - Basics
You want to execute install.sh located in /opt/tools from any directory without typing the full path. What is the best method?
ACopy <code>install.sh</code> to your home directory
BAdd <code>/opt/tools</code> to your PATH environment variable
CRun <code>bash /opt/tools/install.sh</code> every time
DCreate an alias for <code>install.sh</code> in your shell
Step-by-Step Solution
Solution:
  1. Step 1: Understand PATH usage

    PATH variable lists directories searched for executables.
  2. Step 2: Add script directory to PATH

    Adding /opt/tools to PATH allows running install.sh from anywhere.
  3. Final Answer:

    Add /opt/tools to PATH -> Option B
  4. Quick Check:

    Scripts in PATH can be run without full path [OK]
Quick Trick: Add script folder to PATH for easy execution [OK]
Common Mistakes:
MISTAKES
  • Copying scripts instead of updating PATH
  • Using aliases which only work in current shell
  • Running with full path every time

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes