CompTIA Linux+ Powered by LPI (LX0-103) — Question 8
From a Bash shell, which of the following commands directly executes the instruction from the file /usr/local/bin/runme.sh without starting a subshell? (Please select TWO answers.)
Answer options
- A. source /usr/local/bin/runme.sh
- B. . /usr/local/bin/runme.sh
- C. /bin/bash /usr/local/bin/runme.sh
- D. /usr/local/bin/runme.sh
- E. run /usr/local/bin/runme.sh
Correct answer: A, B
Explanation
The commands 'source /usr/local/bin/runme.sh' and '. /usr/local/bin/runme.sh' run the script in the current shell context, meaning they do not create a subshell. In contrast, '/bin/bash /usr/local/bin/runme.sh' and '/usr/local/bin/runme.sh' execute the script in a new subshell, and 'run /usr/local/bin/runme.sh' is not a valid command in this context.