[Discuss] bash output buffering

Bill Bogstad bogstad at pobox.com
Thu Jun 14 14:06:32 EDT 2012


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

Can you be more specific about what you exact commands you are using?
 When I put the following into a file called foo:

===

#!/bin/sh

ping 127.0.0.1 > $HOME/xxx

===

and then run

"at -f foo now"

The "tail -f $HOME/xxx" does exactly what you want (one line every second).

Bill Bogstad



More information about the Discuss mailing list