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