printstuffslowly | ts -s & ARECORD_PID=$!
arecord [options] > ~/recording.wav 2> >(ts -s > ~/errors.log) & ARECORD_PID=$!
From my tests on the command line,
$ARECORD_PID ends up with
ts's PID in it. But what I think I want is
printstuffslowly's PID or
arecord's PID so that I can loop some more commands until it exits:
while kill -0 "$ARECORD_PID" > /dev/null 2>&1 do sleep 1 sync done
Is there a way to get that? Or does
ts's PID actually work just as well for my purpose?