Question 320
Original unofficial RHEL 10 RHCSA skill-check scenario: A health check uses `if grep ...` but routes `grep` no-match to the success branch inadvertently. Which ongoing practice best prevents a recurrence?
Explanation
Correct Answer
In this RHEL 10 system administration case: A health check uses `if grep ...` but routes `grep` no-match to the success branch inadvertently. Underlying reason: Search commands communicate conditions through exit statuses. The most direct, approved resolution is: Branch on the documented zero and nonzero grep statuses and handle read errors separately. Confirm it by checking: Match, no-match and file-read failure have the intended outcomes. Sustain the fix by: Test missing-data as well as no-match cases. This is the INTENDED response for the best ongoing operational safeguard. It is a knowledge-check explanation, not a verified hands-on Red Hat exam answer;
Incorrect Answers
Include negative-path checks in backup jobs. That is not sufficient for the reported RHEL task, because search commands communicate conditions through exit statuses.
Include whitespace filenames in script tests. That is not sufficient for the reported RHEL task, because search commands communicate conditions through exit statuses.
Require known-good and known-bad service test cases. That is not sufficient for the reported RHEL task, because search commands communicate conditions through exit statuses.