[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: rsync --delete



On Tue, 20 Oct 2020 at 06:09, Mike McClain <mike.junk.46@att.net> wrote:

> On a different subject, my guess is that your insistence on quoting
> variables and using arrays for multi-part parameters is that doing so
> as a habit covers the times when a string variable will not expand as
> expected while an array will.

> Please correct me if I'm mis-reading things.

Below is another demo of why it is recommended to always quote shell
parameter expansions as standard practice, unless:
1) not-quoting the parameter is *required* for some reason;
2) the situation is fully controlled;
3) the shell parsing and expansion algorithms and execution sequence
   are completely understood.

$ mkdir demo
$ cd demo
$ touch some files in this directory
$ ls
directory  files  in  some  this
$ foo="* * * important * * *"
$ echo $foo
directory files in some this directory files in some this directory
files in some this important directory files in some this directory
files in some this directory files in some this


Reply to: