• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 873
  • Last Modified:

Korn shell script grep issue

I grepping a log file for the word failure. I want to execute a loop only if there is no "failure" string in the log file.

something like
unless grep "failure"

but there is no unless keyword in shell script. Please advise how would I handle that in Korn shell script.
1 Solution

grep -w failure filename

if test $? -ne 0

put your code here

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now