Bird
0
0

What happens when you use the source command in a bash script?

easy🧠 Conceptual Q1 of 15
Bash Scripting - Functions
What happens when you use the source command in a bash script?
AIt runs the commands from the sourced file in the current shell environment.
BIt copies the sourced file to a new location.
CIt compiles the sourced file into a binary.
DIt deletes the sourced file after execution.
Step-by-Step Solution
Solution:
  1. Step 1: Understand the source command purpose

    The source command reads and executes commands from a file in the current shell environment.
  2. Step 2: Compare options with source behavior

    Only It runs the commands from the sourced file in the current shell environment. correctly describes that the commands run in the current shell, not in a new process or other actions.
  3. Final Answer:

    It runs the commands from the sourced file in the current shell environment. -> Option A
  4. Quick Check:

    source runs commands in current shell = B [OK]
Quick Trick: source runs script in current shell, not a new process [OK]
Common Mistakes:
MISTAKES
  • Thinking source runs script in a new shell
  • Confusing source with copying or deleting files

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes