On Sat, Mar 05, 2005 at 01:25:26PM -0800, Frederik Eaton wrote:
> In which case, do you have boilerplate shell code which parses rsync
> command lines (or is there such code included in the distribution for
> easy update in case the argument syntax changes)? It seems non-trivial
> to me.

It's not needed.  No option name ends in "/", so the function can scan
all the args without understanding them.

If you use zsh or bash, you could put something like this into your rc:

function rsync {
    local cmd=''
    for arg in "$@"; do
        case "$arg" in
        *\'*)
            echo "Args may not contain embedded single quotes!"
            return 1
            ;;
        */)
            arg=${arg/%\//}
            ;;
        esac
        cmd="$cmd '$arg'"
    done
    eval "/usr/bin/rsync $cmd"
}

That's a quick hack, though -- the "eval" idiom can probably be done
better.

..wayne..
-- 
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Reply via email to