Re: [arch-general] [arch-dev-public] Let's agree on a common coding style
On Sat, Feb 13, 2010 at 4:05 PM, Dieter Plaetinck <dieter@plaetinck.be> wrote:
what do you mean context? it only depends on whether the first character after the variablename is a valid character in a variablename or not. if it's valid, use braces. if it isn't, no need for braces.
Arrays can't be used with $array[4], they need to be used as ${array[4]} Also finding the string length, substitution, etc require braces
On Sat, 13 Feb 2010 16:10:08 -0600 Muhammed Uluyol <uluyol0@gmail.com> wrote:
On Sat, Feb 13, 2010 at 4:05 PM, Dieter Plaetinck <dieter@plaetinck.be> wrote:
what do you mean context? it only depends on whether the first character after the variablename is a valid character in a variablename or not. if it's valid, use braces. if it isn't, no need for braces.
Arrays can't be used with $array[4], they need to be used as ${array[4]} Also finding the string length, substitution, etc require braces
okay sure. i agree, but we (or atleast i) were (was) talking about regular variables. Dieter
On 14 February 2010 04:19, Dieter Plaetinck <dieter@plaetinck.be> wrote:
On Sat, 13 Feb 2010 16:10:08 -0600 Muhammed Uluyol <uluyol0@gmail.com> wrote:
On Sat, Feb 13, 2010 at 4:05 PM, Dieter Plaetinck <dieter@plaetinck.be> wrote:
what do you mean context? it only depends on whether the first character after the variablename is a valid character in a variablename or not. if it's valid, use braces. if it isn't, no need for braces.
Arrays can't be used with $array[4], they need to be used as ${array[4]} Also finding the string length, substitution, etc require braces
okay sure. i agree, but we (or atleast i) were (was) talking about regular variables.
We had similar discussions before (I think it was when deciding upon standardising "$pkgdir"), and the conclusion was: "to each his own". We didn't really feel the need to "standardise" anything; most of us were content with "as needed", i.e quotes for when absolute paths are concerned, and braces where characters may interfere or where it is not a variable (array). Until now, I still see: arch=(i686 x86_64) instead of: arch=('i686' 'x86_64') But that makes no difference, aside from maybe treating arch as a pseudo-integer array. Gentoo and ebuilds (although all the other distributions follow similar standards in their scripts) are always the case examples, because they enforce: "${foobar}" Keeping it consistent-by-individual should be enough, i.e you don't change your own style across your works, and if you do you should reflect the new style throughout everything else. -- GPG/PGP ID: B42DDCAD
participants (3)
-
Dieter Plaetinck
-
Muhammed Uluyol
-
Ray Rashif