Bird
0
0

Which of the following is the correct syntax to source a script named lib.sh in bash?

easy📝 Syntax Q12 of 15
Bash Scripting - Functions
Which of the following is the correct syntax to source a script named lib.sh in bash?
Aload lib.sh
Bimport lib.sh
Csource lib.sh
Dinclude lib.sh
Step-by-Step Solution
Solution:
  1. Step 1: Recall bash sourcing commands

    Bash uses source or . to load another script.
  2. Step 2: Identify correct syntax

    source lib.sh correctly loads the script named lib.sh.
  3. Final Answer:

    source lib.sh -> Option C
  4. Quick Check:

    source command = source lib.sh [OK]
Quick Trick: Use 'source' or '.' to load scripts in bash [OK]
Common Mistakes:
MISTAKES
  • Using 'import' which is not a bash command
  • Using 'include' or 'load' which are invalid in bash
  • Forgetting to specify the script name

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes