RegExpr in ---exclude

tim.conway at philips.com tim.conway at philips.com
Mon Jun 24 13:32:01 EST 2002


Sorry.  I didn't mean to imply that the "=" is anything special, just that 
it shrinks the possible shell globs to the list to matching items in the 
"--exclude=" subdirectory.  If that globs, you're using wierd 
filenames.... Not that that can't happen:
tconway at alta:/users/tconway/test
>find . -print
.
./--exclude=
./--exclude=/path
./--exclude=/path/to
./--exclude=/path/to/a
./--exclude=/path/to/a/FoLdEr
tconway at alta:/users/tconway/test
>
But the, that would be awfully inconvenient, wouldn't it.
tconway at alta:/users/tconway/test
>rm -rf *
rm: unrecognized option `--exclude='
Try `rm --help' for more information.
tconway at alta:/users/tconway/test
>rm -rf --exclude=
rm: unrecognized option `--exclude='
Try `rm --help' for more information.
tconway at alta:/users/tconway/test
>

Nonetheless, If you don't consider what will happen to your tape drive if 
someone uses it for a sandwich warmer, your first support call is sure to 
be on that topic.

Cheers,

Tim Conway
tim.conway at philips.com
303.682.4917 office, 3039210301 cell
Philips Semiconductor - Longmont TC
1880 Industrial Circle, Suite D
Longmont, CO 80501
Available via SameTime Connect within Philips, n9hmg on AIM
perl -e 'print pack(nnnnnnnnnnnn, 
19061,29556,8289,28271,29800,25970,8304,25970,27680,26721,25451,25970), 
".\n" '
"There are some who call me.... Tim?"




"Bernard A Badger" <bab at vx.com>
Sent by: rsync-admin at lists.samba.org
06/24/2002 12:05 PM

 
        To:     <rsync at lists.samba.org>
        cc:     (bcc: Tim Conway/LMT/SC/PHILIPS)
        Subject:        RE: RegExpr in ---exclude
        Classification: 



Just a comment on shell glob usage---see below.
> -----Original Message-----
> From: rsync-admin at lists.samba.org [mailto:rsync-admin at lists.samba.org]On
> Behalf Of tim.conway at philips.com
> Sent: Monday, June 24, 2002 12:29 PM
> To: J.Strohschnitter
> Cc: rsync at lists.samba.org
> Subject: Re: RegExpr in ---exclude
>
[SNIP]
> User Commands                                            rsync(1)
>
> Change
> rsync --exclude "/path/to/*/[Ff][Oo][Ll][Dd][Ee][Rr]"
> to
> rsync --exclude=/path/to/*/[Ff][Oo][Ll][Dd][Ee][Rr]
> and try again.  Frankly, I'm surprised you didn't get a usage message 
from
> that one.
>
> Note that I removed the quotes.  They are not necessary, since you won't
> get any shell globbing of your pattern, because of the pattern being
> connected to "--exclude" by "=".  The quotes won't break anything, so 
you
> can leave them in.

Well, sort of.  The "=" isn't special, is just because it's all one 
"word".

Shell globbing is done before the program is invoked, so
the shell globs on "--exclude=/path/to/*/[Ff][Oo][Ll][Dd][Ee][Rr]", but
unless you have a directory "--exclude=", it won't find anything.
It _does_ look for it, though, so it might be kinda slow in a populous
directory.

It's not strictly necessary, but I don't like to advise other people to do
something that "mostly" works, without making the risks clear.  If you 
know that
no such directory exists, use it.  Just don't forget that you're using a
loophole.
Isn't there some option in some shell that causes commands to fail if a 
glob
doesn't generate a result?

If you didn't remember to enter the quotes, you could go ahead because you
know what you're doing.  Command syntax with globs are inherently risky, 
beware
of files named "-?" like "-r", "-f" and "-q".  That's why the "--" option 
was
invented, to keep the glob away from the options.

Be extra careful when you are writing shell scripts.  They'll be invoked 
in
ways you never imagined, so write defensively.


-- 
To unsubscribe or change options: 
http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.tuxedo.org/~esr/faqs/smart-questions.html







More information about the rsync mailing list