Jim Meyering <[EMAIL PROTECTED]> wrote:
> Andreas Schwab <[EMAIL PROTECTED]> wrote:
>> Paolo Bonzini <[EMAIL PROTECTED]> writes:
>>
>>> alias line-buffer='preload /t/linebuf.so'
>>
>> If you end the alias expansion with a space then the next word is also
>> expanded as an alias.
>
> Ah, yes. That was it. Thanks ;-)
To summarize, here's what I'm using, now:
Put the following in your .bashrc or .zshrc file:
# Create the .so file with the following.
line_buffer_so=$HOME/lib/line-buffer.so
line-buffer-init()
{
echo '__attribute__((constructor))void f(){setvbuf(stdout,NULL,_IOLBF,0);}'
\
| gcc -s -include stdio.h -x c - -fPIC -shared -o "$line_buffer_so"
}
alias line-buffer="LD_PRELOAD='$line_buffer_so' "
As a one-time set-up, you have to run the line-buffer-init function.
Then you can use it e.g., to watch *interactively* filtered tail -f output.
For example, watch for warnings in build output like this:
make >& log & line-buffer tail -F log | grep warning:
but that's not quite right, since it hangs forever.
Add --pid=$! to make tail stop when the parent (make) process dies:
make >& log & line-buffer tail -F log --pid=$! | grep warning:
_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils