File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / rsync / support / rsync-slash-strip
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Wed Mar 17 00:32:36 2021 UTC (3 years, 3 months ago) by misho
Branches: rsync, MAIN
CVS tags: v3_2_3, HEAD
rsync 3.2.3

    1: #!/usr/bin/env bash
    2: # This script can be used as an rsync command-line filter that strips a single
    3: # trailing slash from each arg.  That treats "src/" the same as "src", thus
    4: # you need to use "src/." or "src//" for just the contents of the "src" dir.
    5: # (Note that command-line dir-excludes would need to use "excl//" too.)
    6: #
    7: # To use this, name it something like "rs", put it somewhere in your path, and
    8: # then use "rs" in place of "rsync" when you are typing your copy commands.
    9: args=()
   10: for arg in "${@}"; do
   11:     if [[ "$arg" == / ]]; then
   12: 	args=("${args[@]}" /)
   13:     else
   14: 	args=("${args[@]}" "${arg%/}")
   15:     fi
   16: done
   17: exec /usr/bin/rsync "${args[@]}"

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>