[Discuss] bash output buffering

Edward Ned Harvey blu at nedharvey.com
Wed Jun 13 07:06:08 EDT 2012


> From: discuss-bounces+blu=nedharvey.com at blu.org [mailto:discuss-
> bounces+blu=nedharvey.com at blu.org] On Behalf Of Jack Coats
> 
> In old SunOS days, we could issue the 'sync' command, twice, to ensure
> all system

Oh - That would be the command to flush memory to disk.  I'm talking about a
level above that.

A command inside of bash generates output every second (ping) redirected to
a file.
If you run the command on an interactive shell, then you can tail -f the
file, and see the output "live" as it happens.
But if you run the command inside an "at" script, or a cron script, you tail
-f the file...  And nothing appears for a few minutes, and then it all
appears suddenly.

This is bash buffering the output of ping, before redirecting to file.  All
of which is a level above the OS filesystem buffering.  I don't care if the
OS filesystem buffer gets flushed - I just want to be able to tail -f the
file, and see the output as it happens.




More information about the Discuss mailing list