I have the following setup:
#!/bin/bash
# call.sh
voip_binary $1
Now when I a certain event happens (when I hang up), then the voip_binary
emits a certain string: ... [DISCONNCTD] ...
However, the script does not stop, but continues running. Now as soon as DISCONNCTD
is discovered in the output, I want to kill the script.
So I could do the following, to get the relevant output:
voip_binary $1 | grep DISCONNCTD
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.
You can try this:
Assuming
voip_binary
outputs your string without buffering.