QuestionQ38

VerifiedAutomation, Orchestration, and Scripting

A systems administrator must write a script to count how many times “FAIL” occurs in a log file. If “FAIL” occurs zero times, the administrator wants to print “SUCCESS.” Given the following:

Question Image

Which of the following should be placed before zero to complete the script?

Explanation

In shell numeric tests, -eq checks whether two integers are equal. Comparing the grep -c result with -eq 0 makes the condition true when no FAIL matches are found, causing SUCCESS to be printed.

Community Discussion

No comments yet. Be the first to start the discussion!