Gentoo Archives: gentoo-dev

From: Donnie Berkholz <dberkholz@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Opinions Wanted - Arrays again :)
Date: Thu, 25 Oct 2007 21:34:07
Message-Id: 20071025213113.GJ29642@supernova
In Reply to: [gentoo-dev] Opinions Wanted - Arrays again :) by Roy Marples
1 On 16:40 Thu 25 Oct , 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 Is there any way we could avoid these altogether, and instead use
37 separate variables for each array element?
38
39 Thanks,
40 Donnie
41 --
42 gentoo-dev@g.o mailing list

Replies

Subject Author
Re: [gentoo-dev] Opinions Wanted - Arrays again :) Roy Marples <uberlord@g.o>