4

I have just run the following command in a bash script

rsync -av -update  --dry-run --delete $EX "$FROM" "$TO"

the sync ran, --dry-run was ignored (luckily that was ok this time).

Does any one see any reason why --dry-run would be ignored here?

6

That's because the correct option is --update, not -update. Your command should be:

rsync -av --update --dry-run ...

When rsync does the dry-running, the last line of default rsync stat output will show the string (DRY RUN) e.g.:

total size is 0  speedup is 0.00 (DRY RUN)

Full output:

% rsync -av --update --dry-run foobar out/
sending incremental file list
foobar

sent 62 bytes  received 19 bytes  162.00 bytes/sec
total size is 0  speedup is 0.00 (DRY RUN)
  • thank you that solved it, dangerous mistake to make on my part. – nogad Jan 16 '17 at 3:26
  • @nogad It happens. Whenever in doubt, take a peek at the man page :) – heemayl Jan 16 '17 at 3:27
  • i dont understand why some arguments require one hash and some two – nogad Jan 16 '17 at 3:28
  • 1
    @nogad For expanded option name, most of them use -- (POSIX), - is typically used for single letter (short) arguments. If you find a long argument using -, thats an exception. – heemayl Jan 16 '17 at 3:31
  • 2
    @nogad You were really unlucky as the -e part of the [-]-update needs a value so it gobbled up the next argument i.e. --dry-run. If your to and from directories were local then the -e option would not be used, and wouldn't cause a fail. – meuh Jan 16 '17 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.