Exam XK0-006 Topic 2 Question 51 Discussion

Actual exam question for CompTIA's XK0-006 exam
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?

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

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Nick name: Submit Cancel
A voting comment increases the vote count for the chosen answer by one.

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.

0
0
0
10