diff options
-rwxr-xr-x | sync | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -168,6 +168,8 @@ sync() { local descriptor local name local match + local dry + local dry_description set -e @@ -197,6 +199,12 @@ sync() { continue fi + if [ -n "$DRY" ] + then + dry="--dry-run" + dry_description=" \e[1;31m(dry run)\e[0m" + fi + source_path=$( host_file_path "$descriptor" ) destination_path=$( host_file_path "$match" ) @@ -204,9 +212,9 @@ sync() { host_excludes "$destination_name" "$name" >> "$DOTEXCLUDES" host_excludes "$source_name" "$name" >> "$DOTEXCLUDES" - echo -e "Sync \e[1;34m$name\e[0m from \e[1;33m$source\e[0m to \e[1;33m$destination\e[0m" + echo -e "Sync \e[1;34m$name\e[0m from \e[1;33m$source\e[0m to \e[1;33m$destination\e[0m$dry_description" - $RSYNC --exclude-from="$DOTEXCLUDES" "$source_prefix$source_path" "$destination_prefix$destination_path" + $RSYNC $dry --exclude-from="$DOTEXCLUDES" "$source_prefix$source_path" "$destination_prefix$destination_path" rm "$DOTEXCLUDES" done |