Gentoo Archives: gentoo-dev

From: Josh Saddler <nightmorph@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Opinions Wanted - Arrays again :)
Date: Thu, 25 Oct 2007 17:21:56
Message-Id: 4720CFE1.1060406@gentoo.org
In Reply to: [gentoo-dev] Opinions Wanted - Arrays again :) by Roy Marples
1 Roy Marples wrote:
2 > Hello List
3 >
4 > It's your favourite posix shell lover here, asking for your honest
5 > opinions.
6 >
7 > array="1.2.3.4 netmask 5.6.7.8;
8 > \*
9 > 'host.name' netmask 1.2.3.4
10 > -I 'option; $FOO with spaces'
11 > "
12 >
13 > array=("1.2.3.4 netmask 5.6.7.8;"
14 > "\*"
15 > "'host.name' netmask 1.2.3.4"
16 > "-I 'option; $FOO with spaces'"
17 > )
18 >
19 > array="'1.2.3.4 netmask 5.6.7.8;' \
20 > '\*' \
21 > \"'host.name' netmask 1.2.3.4\" \
22 > \"-I 'option; $FOO with spaces'\"
23 > "
24 >
25 > The first and last are of course posix constructs whilst the middle is
26 > bash.
27 >
28 > The bash one is purely there for reference, and of course you can still
29 > use it if /bin/sh is bash. The last one is what baselayout-2 currently
30 > uses and I'm wondering if we should switch to the first one before we
31 > come out of package.mask.
32 >
33 > I'm asking which you think are the most readable of the first and last
34 > ones and if you see any issues with either.
35
36 The first is much more readable than the last, but only slightly more
37 readable than the middle one. I'm not a sh/bash guru the way many of the
38 developers are, and I can tell you right up front that I'd be more
39 comfortable configuring options if they looked more like the first
40 example, and I'd guess many users would feel the same way. The fewer " '
41 ; \ characters there are to keep track of, the better.

Attachments

File name MIME type
signature.asc application/pgp-signature