Exam XK0-006 Topic 2 Question 51 Discussion
Actual exam question for CompTIA's XK0-006 exam
Question #: 51
Topic #: 2
Question #: 51
Topic #: 2
A systems administrator needs to write a script that counts the number of times "FAIL" appears in a log file. If "FAIL" appears zero times, then the administrator would like to print the message
"SUCCESS." Given the following:

Which of the following should be used before the zero to complete the script?
"SUCCESS." Given the following:

Which of the following should be used before the zero to complete the script?
Suggested Answer: D Vote an answer
The test should check if the count of "FAIL" equals zero. The operator -eq is used for numeric equality in shell conditionals, so [ $(grep -c FAIL /var/file.log) -eq 0 ] correctly evaluates whether the count is zero.
by Dick at Apr 09, 2026, 02:36 PM
0
0
0
10
Comments
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Report Comment
Commenting
You can sign-up / login (it's free).