Lpic 1 Linux Administrator · Free Practice Question Easy

Question 25

In a Bash shell, which command executes the instructions from the file /usr/local/bin/runme.sh directly in the current shell, without starting a subshell?

  • A

    source /usr/local/bin/runme.sh

  • B

    /usr/local/bin/runme.sh

  • C

    bin/usr/local/bin/runme.sh

  • D

    call /usr/local/bin/runme.sh

Reveal correct answer

Correct answer: A

A.

The source command runs the script in the current shell environment without starting a new process or subshell. This allows any changes made by the script (e.g., variable assignments, directory changes) to persist in the current shell session.

B.

Running the script directly using its path starts a new process (subshell), which is not desired here. The script will run in a separate shell, so changes to the environment (like variables or directory) will not affect the current shell.

C.

This is not a valid path and will result in a "No such file or directory" error. Even if corrected, directly executing a script still spawns a subshell.

D.

call is not a valid Bash command. This syntax comes from Windows batch scripting and will result in a "command not found" error in Bash.

Discussion

Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.

You must be logged in to post a comment.

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need