Exam LFCS All QuestionsBrowse all questions from this exam
Question 68

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.)

    Correct Answer: A, B

    To execute the instructions from the file /usr/local/bin/runme.sh without starting a subshell, you can use either source /usr/local/bin/runme.sh or . /usr/local/bin/runme.sh. Both commands execute the script within the current shell environment, ensuring that any changes made by the script, such as variable assignments or function definitions, will persist in the current shell session.

Discussion
StribOptions: AB

The two correct answers are: A. source B. . Explanation: A. The 'source' command (or its equivalent '.') is used to execute the contents of a script file within the current shell environment. When you use the 'source' or '.' command, the instructions from the specified file, in this case, '', are directly executed without starting a subshell. The changes made by the script, such as variable assignments or function definitions, will persist in the current shell. B. Similarly, using the '.' command followed by the path to the script, like '. ', also executes the script within the current shell environment without creating a subshell. The instructions from the script will be executed directly in the current shell.

BorbzOptions: AB

Answers are correct. A and B.