flush output in Bourne Shell

Posted by n-alexander on Stack Overflow See other posts from Stack Overflow or by n-alexander
Published on 2009-03-04T11:27:28Z Indexed on 2010/12/31 1:54 UTC
Read the original article Hit count: 619

Filed under:
|
|

I use echo in Upstart scripts to log things:

script
    echo "main: some data" >> log
end script

post-start script
    echo "post-start: another data" >> log
end script

Now these two run in parallel, so in the logs I often see:

main: post-start: some data another data

This is not critical, so I won't employ proper synching, but thought I'd turn auto flush ON to at least reduce this effect. Is there an easy way to do that?

Update: yes, flushing will not properly fix it, but I've seen it help such situations to some degree, and this is all I need in this case. It's just that I don't know how to do it in Shell

© Stack Overflow or respective owner

Related posts about linux

Related posts about shell