0
until commandThatProducesOutput | grep -m 1 "Done"
do
        ???
        sleep 5
done

While this script is running, I'd like to pipe the output that commandThatProducesOutput produces to the screen but can't seem to get the correct syntax.

cactusphone
  • 507
  • 4
  • 15
  • [xy-problem?](http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem) – clt60 Oct 03 '14 at 22:15
  • 2
    Seems like `command ... | tee /dev/tty | grep ...` should do what you want. See [how-to-pipe-stdout-while-keeping-it-on-screen-and-not-to-a-output-file](http://stackoverflow.com/questions/5677201/how-to-pipe-stdout-while-keeping-it-on-screen-and-not-to-a-output-file). – John B Oct 03 '14 at 22:20

1 Answers1

1

How about:

output=$(commandThatProducesOutput)

until echo "$output" | grep -m 1 "Done"
do
    echo "$output"
    output=$(commandThatProducesOutput)
done
Vivek Ghaisas
  • 961
  • 1
  • 9
  • 24