Question 530
A Linux administrator needs to resolve the following condition: A command fails but a pipeline reports success because the final grep exits zero. What is the most appropriate targeted action?
Explanation
Correct Answer
The fix addresses the cause: an upstream failure can be masked by a successful downstream command. A suitable acceptance test is that the pipeline returns nonzero when an early stage fails.
Incorrect Answers
That remedy is appropriate when an incident analyst needs lines matching either ERROR or WARN in a text log. It targets grep supports regular-expression alternatives with extended regex mode; here an upstream failure can be masked by a successful downstream command, so it does not directly repair the observed fault.
It would correct a separate failure, a script reads a report but the path is relative and the current working directory changes. In this environment, an upstream failure can be masked by a successful downstream command; the indicated alternative does not meet the acceptance test.
That remedy is appropriate when a report script sorts numeric counts but places 100 before 20. It targets lexicographic sorting compares character sequences rather than numeric magnitude; here an upstream failure can be masked by a successful downstream command, so it does not directly repair the observed fault.





CompTIA Linux+ (XK0-006) Practice Tests