> But if the shared library is installed, you can
> instead use your own line-buffer function:
> 
> line-buffer()
> {
>   LD_PRELOAD=/t/linebuf.so "$@"
> }
> 
> but that doesn't expand the command name when it's an alias or function.

It actually works for functions.  To support aliases, you can do

  preload() {
    local so cmd
    so=$1
    cmd=$2
    shift 2
    case x`type -t "$cmd"` in
      xalias) eval LD_PRELOAD=\$so $cmd \"[EMAIL PROTECTED]" ;;
      *) LD_PRELOAD=$so "$cmd" "$@" ;;
    esac
  }

  alias line-buffer='preload /t/linebuf.so'

Paolo


Reply via email to