title: Kill a child-script when it emits a certain string
body: <p>I have the following setup:</p>
  
  <pre><code>#!/bin/bash
  # call.sh
  
  voip_binary $1
  </code></pre>
  
  <p>Now when I a certain event happens (when I hang up), then the <code>voip_binary</code> emits a certain string: <code>... [DISCONNCTD] ...</code>
  However, the script does not stop, but continues running. Now as soon as <code>DISCONNCTD</code> is discovered in the output, I want to kill the script.</p>
  
  <p>So I could do the following, to get the relevant output:</p>
  
  <pre><code>voip_binary $1 | grep DISCONNCTD
  </code></pre>
  
  <p>Even though I now only get relevant output from the binary, I still don't know how to kill it, as soon as a line is emitted.</p>