bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Waiting for outpu


From: Matthew Woehlke
Subject: Re: Waiting for outpu
Date: Wed, 11 Jun 2008 11:34:18 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.14) Gecko/20080501 Fedora/2.0.0.14-1.fc8 Thunderbird/2.0.0.14 Mnenhy/0.7.5.0

stoyboy wrote:
I am trying to create a script that will run continuously until the out of a
command reaches a specific point.
I have a command called showOutput and all it does it output the progress of
running job, i want to create a script or a command that will process this
output and do something else once it sees the job has gotten to a specific
point. What I have come up with so far is something like this:

#this will give me only the 1 specific line i am waiting to see
showOutput | grep "condition"

#if i use this in an if statement or a loop like this:
until [ $( showOutput | grep "condition" ) ] do sleep(60); done
#run other command here

but i think because showOutput does not have an eof things dont work right
if anyone can help that would be greatly appreciated

Assuming your output is line-delimited, it sounds like you want something like this:

processOutput() { # pipe output to this function
  local l
  while read l ; do
    echo "$l" | grep "condition" &>/dev/null && break
    doSomething1
  done
  while read l ; do
    doSomething2
  done
}

--
Matthew
I think I want my tombstone to read:
<name>
Process created <date of birth>
Signal 15 received <date of death>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]