On Sun, Sep 27, 2020 at 03:19:17PM -0700, Will McGinnis via rsync <rsync@lists.samba.org> wrote:
> Hello, A GUI program uses rsync for network transfers. It is able to > load filters from a file by putting a dot and underscore before it. > Example:mkdir 1 2; touch 1/a .empty; rsync -f ._empty 1/ 2/ > > Is the dot underscore specific to rsync or is it a general bash (or > similar?) feature to load arguments from a file? And is it documented > anywhere for rsync? >From the manpage: FILTER RULES [...] Rsync builds an ordered list of filter rules as specified on the command-line. Filter rules have the following syntax: RULE [PATTERN_OR_FILENAME] RULE,MODIFIERS [PATTERN_OR_FILENAME] You have your choice of using either short or long RULE names, as described below. If you use a short-named rule, the ',' separating the RULE from the MODIFIERS is optional. The PATTERN or FILE- NAME that follows (when present) must come after either a single space or an underscore (_). Here are the available rule prefixes: merge, '.' specifies a merge-file to read for more rules. So the "." means load rules from a file, and the "_" is like an alternative to a space for separating the "." and the filename. It seems that the space isn't optional when using the short form, like the comma is. I think this is rsync-specific. I have seen programs use a convention of an "@" prefix to an option argument to indicate that the rest of the option argument is a filename to read the real option arguments from. And I have seen libraries that provide command line option functionality with support for config files for default options. A general purpose way of getting command line options from a file, if you have a shell available, is to store command line options in a file like this: --optiona ... --optionb ... --optionc ... And then use them with on the command line like this: cmd `cat cmd-options` args... cheers, raf -- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html