Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] Rsync exclusion question
- Date: Fri, 12 Jun 2009 10:09:34 +0100
- From: Josh Glover <jmglov@example.com>
- Subject: Re: [tlug] Rsync exclusion question
- References: <956ae5a90906100208k6ec1aeebnebb17f7534b8183a@example.com> <956ae5a90906100308l215adc81m1dcfbb54dc826472@example.com> <d8fcc0800906100527p59d4d548v42999d96e7ad066c@example.com> <956ae5a90906100547i2e610cct42b8b075c50b6d6@example.com> <d8fcc0800906100614s4c909d0fj8091e3bfe9926c18@example.com> <4A30D148.1090004@example.com> <d8fcc0800906110258y553b9712hcb55c5a3ed4b6d69@example.com> <956ae5a90906110321k54545d53rb3cbae6f7044aaa0@example.com> <d8fcc0800906110355h21af4adtce1ddc3d95164988@example.com> <4A31BD61.2000900@example.com>
2009/6/12 John Fremlin <john@example.com>: > Josh Glover wrote: > >> I think the Best Practise to always use non-interpolating quotes >> unless you know you need interpolation is the way to go. That way, >> you don't need to understand the interpolation rules of your >> programming language all the way down to the metal. > > I don't know how you can include not understanding the language you are > using in a Best Practice ;-) I hope you know what I meant. Interpolation in the shell can quickly devolve from "simple rules" to a recursively nastier situation, when you have scripts calling programs calling scripts. 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. I've seen old Unix hands tripped up by shell interpolation many times. > (Both over- and under- quoting cause problems.) This statement is significantly general enough to be true. :) > I don't understand why the problem was allegedly fixed by changing > between " and ' quotes; perhaps we haven't heard the full story. Me neither, but I think it has to do with how Doug is invoking his script. I'll walk over to his desk later as time allows and see if I can understand what is happened. > From the Bash manpage [...] >> The special parameters * and @ have special meaning when in double >> quotes (see PARAMETERS below). PARAMETERS [...] Positional Parameters A positional parameter is a parameter denoted by one or more digits, other than the single digit 0. Positional parameters are assigned from the shell's arguments when it is invoked, and may be reassigned using the set builtin com‐ mand. Positional parameters may not be assigned to with assignment state‐ ments. The positional parameters are temporarily replaced when a shell func‐ tion is executed (see FUNCTIONS below). When a positional parameter consisting of more than a single digit is expanded, it must be enclosed in braces (see EXPANSION below). 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. I'll leave it at, this: huh. -- Cheers, Josh
- Follow-Ups:
- Re: [tlug] Rsync exclusion question
- From: Doug McLean
- Re: [tlug] Rsync exclusion question
- From: Stephen J. Turnbull
- Re: [tlug] Rsync exclusion question
- From: John Fremlin
- References:
- [tlug] [TLUG] Rsync exclusion question
- From: Doug McLean
- Re: [tlug] [TLUG] Rsync exclusion question
- From: Doug McLean
- Re: [tlug] [TLUG] Rsync exclusion question
- From: Josh Glover
- Re: [tlug] [TLUG] Rsync exclusion question
- From: Doug McLean
- Re: [tlug] [TLUG] Rsync exclusion question
- From: Josh Glover
- Re: [tlug] Rsync exclusion question
- From: John Fremlin
- Re: [tlug] Rsync exclusion question
- From: Josh Glover
- Re: [tlug] Rsync exclusion question
- From: Doug McLean
- Re: [tlug] Rsync exclusion question
- From: Josh Glover
- Re: [tlug] Rsync exclusion question
- From: John Fremlin
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] OT: about iphone
- Next by Date: Re: [tlug] Rsync exclusion question
- Previous by thread: Re: [tlug] Rsync exclusion question
- Next by thread: Re: [tlug] Rsync exclusion question
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links