Gentoo Archives: gentoo-dev

From: Roy Marples <uberlord@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Opinions Wanted - Arrays again :)
Date: Fri, 26 Oct 2007 06:31:44
Message-Id: 1193380105.2913.1.camel@uberpc.marples.name
In Reply to: Re: [gentoo-dev] Opinions Wanted - Arrays again :) by Donnie Berkholz
1 On Thu, 2007-10-25 at 15:56 -0700, Donnie Berkholz wrote:
2 > On 22:49 Thu 25 Oct , Roy Marples wrote:
3 > > On Thu, 2007-10-25 at 14:31 -0700, Donnie Berkholz wrote:
4 > > > Is there any way we could avoid these altogether, and instead use
5 > > > separate variables for each array element?
6 > >
7 > > Well, we could prefix with numbers
8 > >
9 > > array="1.2.3.4 netmask 5.6.7.8;
10 > > \*
11 > > 'host.name' netmask 1.2.3.4
12 > > -I 'option; $FOO with spaces'"
13 > >
14 > > Would become
15 > >
16 > > 0_config_eth0="1.2.3.4 netmask 5.6.7.8;"
17 > > 1_config_eth0="\*"
18 > > 2_config_eth0="'host.name' netmask 1.2.3.4"
19 > > 3_config_eth0="-I 'option; $FOO with spaces'"
20 >
21 > I was hoping for some sort of meaningfully named separate variables, not
22 > an even messier fake array.
23
24 I'm all ears for any other suggestions :)
25
26 BTW, my example fails as shell does not allow numbers to prefix variable
27 names. Would have to be something like a0_ a1_
28
29 Thanks
30
31 Roy
32
33 --
34 gentoo-dev@g.o mailing list

Replies

Subject Author
Re: [gentoo-dev] Opinions Wanted - Arrays again :) Richard Freeman <rich@××××××××××××××.net>