feature request

Wayne Davison wayned at samba.org
Sat Mar 5 21:45:30 GMT 2005


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..


More information about the rsync mailing list