Home Man
Search
Today's Posts
Register

If you're not sure where to post a Unix or Linux question, post it here. All unix and Linux beginners welcome in this forum!

Grep command in a loop

👤 Login to reply

 
Thread Tools Search this Thread
# 1  
Old 05-16-2018
Grep command in a loop

Hello -

I am running a script that is outputting to a log. Let call it output.log
I would like to monitor that log until the line "Build Successful" is found.

I think I would need to use the grep command.
How would I do that in a loop?

Thanks
Marty
# 2  
Old 05-16-2018
It'd be much better to watch the return code of the script if you can. Usually it will return 0 for success, anything else for error.

You can do
Code:
tail -f build.log | grep -l -q "Build Successful"

but if "Build Successful" never appears, it will wait forever.

The same problem faces any approach really. Without some way to tell when it's failed, it has no termination condition.
The Following User Says Thank You to Corona688 For This Useful Post:
RavinderSingh13 (05-16-2018)
👤 Login to reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Ps ax with grep in loop nms Shell Programming and Scripting 9 07-11-2018 01:50 PM
Grep issue in for loop Aditya_001 Shell Programming and Scripting 3 01-03-2014 05:58 AM
GREP loop jcllns1 Homework & Coursework Questions 7 02-20-2013 09:54 PM
using grep in a while loop guyiom Red Hat 5 02-02-2012 11:26 AM
Help on grep in a do while loop r4v3n Shell Programming and Scripting 3 06-24-2011 02:21 PM
grep sed and a loop gunnahafta UNIX for Dummies Questions & Answers 3 05-12-2011 12:21 AM
Using grep within a while loop turkishvan Shell Programming and Scripting 8 04-23-2011 01:59 PM
Help with grep inside an if loop daf189 Shell Programming and Scripting 3 04-10-2011 11:25 PM
grep -v while loop bobo UNIX for Dummies Questions & Answers 8 01-26-2007 09:53 PM
grep in a loop gundu Shell Programming and Scripting 7 03-28-2005 03:59 PM


All times are GMT -4. The time now is 01:23 AM.

Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password