Jim Meyering wrote: > 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:
grep --color 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: > That's a tip and a half. I'll certainly be using that, Though I'll probably auto-compile the lib like: [ ! -x "$line_buffer_so" ] && line-buffer-init() Of course this solution depends on gcc and LD_PRELOAD etc. What about adding buffer control to all coretuils filters. Is that still a desired feature do you think? cheers, Pádraig. _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils