Piping to notify-send in chunks
<p>I'm trying to compose a command to send unix output to my desktop notifications using the <code>notify-send</code> cl tool. I have the following command:</p>

<p><code>mocha -w | while read SPAM_OUT; do notify-send -t 5000 "mocha:" "$SPAM_OUT"; done
</code>
Which does what I want, except that I'd like it to spit out the entirety of mocha's output in a single notification every time mocha barfs out some new stuff. Right now, I get a notification for every single line, which is profoundly annoying. </p>

<p>If there are any tools which should already do this for me, I'd be interested in them too. </p>