Exam LFCS All QuestionsBrowse all questions from this exam
Question 82

Which variable defines the directories in which a Bash shell searches for executable commands?

    Correct Answer: C

    The variable that defines the directories in which a Bash shell searches for executable commands is PATH. PATH is an environment variable that contains a colon-separated list of directories. When a command is issued in the shell, it sequentially checks each directory listed in PATH to locate the executable file. If the file is not found in any of the PATH directories, the shell returns a 'command not found' error.

Discussion
StribOption: C

The correct answer is C. The directories in which a Bash shell searches for executable commands are defined by the PATH variable. PATH is an environment variable that contains a colon-separated list of directories. When a command is entered in the shell, it looks for the command in each directory listed in PATH, in the order specified, until it finds the executable file. If the command is not found in any of the directories listed in PATH, the shell will display a "command not found" error.

Strib

A. BASHEXEC: This is not a standard environment variable in Bash. It does not define the directories for searching executable commands. B. BASHRC: This variable represents the filename of the Bash configuration file that is sourced when a new interactive shell is started. It does not define the directories for searching executable commands. D. EXECPATH: This is not a standard environment variable in Bash. It does not define the directories for searching executable commands. E. PATHRC: This is not a standard environment variable in Bash. It does not define the directories for searching executable commands. In summary, only option C, PATH, defines the directories in which a Bash shell searches for executable commands.