CompTIA Linux+ (XK0-005) — Question 96
An administrator installed an application from source into /opt/operations1/ and has received numerous reports that users are not able to access the application without having to use the full path /opt/operations1/bin/*. Which of the following commands should be used to resolve this issue?
Answer options
- A. echo 'export PATH=$PATH:/opt/operations1/bin' >> /etc/profile
- B. echo 'export PATH=/opt/operations1/bin' >> /etc/profile
- C. echo 'export PATH=$PATH/opt/operations1/bin' >> /etc/profile
- D. echo 'export $PATH:/opt/operations1/bin' >> /etc/profile
Correct answer: A
Explanation
The correct answer is A because it appends the application's directory to the existing PATH variable, allowing users to run the application without specifying the full path. Option B incorrectly sets the PATH without preserving the existing entries, while option C has a syntax error as it lacks a proper separator for the PATH variable. Option D incorrectly uses the syntax for exporting the variable, which does not correctly set the PATH.