I was wondering if it was possible to tell bash that all calls to
If comands use stdio and are connected to a terminal they'll be flushed per line. Otherwise you'll need to use something like stdbuf on commands in a pipe line http://www.pixelbeat.org/programming/stdio_buffering/
tl;dr: instead of
printf ... try to put to the script
stdbuf -o0 printf .., or
stdbuf -oL printf ...