Linux Foundation Certified System Administrator (LFCS) — Question 22
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 in options A and B, 'source /usr/local/bin/runme.sh' and '. /usr/local/bin/runme.sh', execute the script in the current shell environment, hence they don't create a subshell. Options C and D execute the script in a new shell, while option E is not a valid command for executing scripts.