Bird
0
0

You wrote source lib.sh but get "No such file or directory" error. What is the likely cause?

medium📝 Debug Q7 of 15
Bash Scripting - Functions
You wrote source lib.sh but get "No such file or directory" error. What is the likely cause?
AThe shell does not support sourcing.
BThe <code>source</code> command is misspelled.
CThe script has syntax errors.
DThe file <code>lib.sh</code> is not in the current directory or path.
Step-by-Step Solution
Solution:
  1. Step 1: Understand file path for sourcing

    Sourcing requires the file to exist at the given path. If missing, shell reports file not found.
  2. Step 2: Check other options

    Command misspelling or syntax errors cause different errors. Shell always supports sourcing in bash.
  3. Final Answer:

    The file lib.sh is not in the current directory or path. -> Option D
  4. Quick Check:

    File missing causes no such file error = A [OK]
Quick Trick: Check file path if 'No such file' error on source [OK]
Common Mistakes:
MISTAKES
  • Assuming syntax error causes file not found
  • Thinking shell lacks source support

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes