Mailing List Archive


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

Re: [tlug] Rsync exclusion question



Josh Glover wrote:
Of course one *should* understand the basics of interpolation in any
language one uses. But the Best Practice is about avoiding
interpolation altogether unless you *know* you want it in a string,
and then understanding the rules as they apply to that string.

How is interpolation relevant to the (alleged) difference between "*.leases" and '*.leases'?

I've seen old Unix hands tripped up by shell interpolation many times.

It can lead to very serious bugs so I don't see how there are any excuses for being muddled up.

I've seen excellent C programmers mix up = and == but they at least had the decency to feel extremely embarrassed by it.

Stephen J. Turnbull wrote:
> Josh Glover writes:
>  > Me neither, but I think it has to do with how Doug is invoking his
>  > script.
>
> I find this is invariably because I (a) wrote a script or shell
> function for unit testing, and quotes are being stripped there, or (b)
> some command I thought was either a shell built-in or a real program
> was replaced by a shell script, usually by a distro trying to make
> something like the autofools more "user-friendly".

Excellent point.

PARAMETERS
[...]
   Positional Parameters

What's this got to do with anything?

[...]

   Special Parameters
       The shell treats several parameters specially.  These
parameters may  only  be
       referenced; assignment to them is not allowed.
       *      Expands  to  the  positional  parameters,  starting from
one.  When the
              expansion occurs within double quotes, it expands to a
single word with
              the value of each parameter separated by the first
character of the IFS
              special variable.  That is, "$*" is equivalent to
"$1c$2c...", where  c
              is  the  first  character  of the value of the IFS
variable.  If IFS is
              unset, the parameters are separated by spaces.  If  IFS
is  null,  the
              parameters are joined without intervening separators.


But what Doug was doing shouldn't have triggered any magic with *, AFAICT.

Yes, because that part of the manpage is talking about $* and "$*" I think?



Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links