[H-GEN] Useful not so obvious tips

Greg Black gjb at gbch.net
Tue Oct 26 01:46:33 EDT 2004


On 2004-10-26, Anthony Towns wrote:

> What's really sad is that you can't use find as the command for xargs
> -- xargs adds the arguments at the end of the command line, and find
> requires the path arguments to appear at the beginning. Suck. :(

Of course, if this bothers anyone, the shell script to solve it
takes about a minute to invent:

    #!/bin/sh
    # usage: ... | xargs xafind <find options> --
    while : ; do
        if [ "$1" = "--" ] ; then shift ; break ; fi
        args="${args} $1"
        shift
    done
    exec find "$@" ${args}

That's untested, so the usual caveats apply; but it would be
trivial to adapt as needed.

Cheers, Greg




More information about the General mailing list