[Discuss] bash output buffering

John Abreau abreauj at gmail.com
Wed Jun 13 07:44:37 EDT 2012


On Wed, Jun 13, 2012 at 7:06 AM, Edward Ned Harvey <blu at nedharvey.com> wrote:

> 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.

What you're describing is the difference between OS tty buffering vs
OS filesystem buffering. This has nothing at all to do with bash; both
occur below bash at the OS level.

The difference is that OS filesystem buffering is block-oriented, and
OS tty buffering is character-oriented.


-- 
John Abreau / Executive Director, Boston Linux & Unix
PGP KeyID: 32A492D8 / Email: abreauj at gmail.com
PGP FP: 7834 AEC2 EFA3 565C A4B6  9BA4 0ACB AD85 32A4 92D8



More information about the Discuss mailing list