I was wondering if it was possible to tell bash that all calls to echo or printf should be followed up by a subsequent call to fflush()
echo
printf
fflush()
If you force the file to be read, it seems to cause the buffer to flush. These work for me.
Either read the data into a useless variable:
x=$(<$logfile)
Or do a UUOC:
cat $logfile > /dev/null