Why do bash parameter expansions cause an rsync command to operate differently?

后端 未结 2 1255
猫巷女王i
猫巷女王i 2020-12-21 11:47

I am attempting to run an rsync command that will copy files to a new location. If I run the rsync command directly, without any parameter expansions on the command line, r

2条回答
  •  南笙
    南笙 (楼主)
    2020-12-21 12:03

    I like to break the arguments onto separate lines, for convenience sake:

    ROPTIONS=(
       -aNHXxEh
       --delete
       --fileflags
       --exclude-from=$EXCLUDELIST
       --delete-excluded
       --force-change
       --stats
       --protect-args
    )
    

    and then call it thusly:

    rsync "${ROPTIONS[@]}" "$SOURCE" "$DESTINATION"
    

提交回复
热议问题