[Top][All Lists]

[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: Gecko/20080501 Fedora/ Thunderbird/ Mnenhy/

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
  while read l ; do

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

reply via email to

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