Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • Thanks a lot @Kusalananda, it's great! PS: rsync --read-batch=abc-diff ${1:-abc} (automatically generated .sh script) gave remote destination is not allowed with --read-batch rsync error: syntax or usage error (code 1) at main.c(1326) [Receiver=3.1.2], but rsync --read-batch=abc-diff abc worked succesfully. What is the difference between these two similar commands? Commented Feb 3, 2020 at 19:21
  • 2/2 Is there a way to take abc as input, apply the patch diff-abc with --read-batch but not modify abc "in-place", but rather output to a new file abc3? (if possible all with rsync, without piping, so that it will work easily on Linux as well as Windows which also has rsync.exe available) Commented Feb 3, 2020 at 19:30
  • @Basj The commands would do different things if $1 had a value. ${1:-abc} means "use the first positional parameter ($1) unless it's empty or undefined. In the case that it's empty or undefined, use abc instead". I'm assuming that $1 had a value when you tried it, possibly something that it interpreted as a remote destination address. Commented Feb 3, 2020 at 20:34
  • @Basj I'm not entirely sure that this is possible, but I'll have a look tomorrow after sleep. Commented Feb 3, 2020 at 20:36
  • Thanks for your answer about ${1:-abc}. It probably failed is because I tried it on Windows (I'm using rsync both on Linux for my distant server, and Windows locally). But it's perfect since rsync --read-batch=abc-diff abc works :) Commented Feb 3, 2020 at 20:38