Gentoo Archives: gentoo-dev

From: "Harald van Dijk" <truedfx@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Network configuration and bash
Date: Fri, 09 Feb 2007 09:56:48
Message-Id: 20070209095129.GA10669@gentoo.org
In Reply to: Re: [gentoo-dev] Network configuration and bash by Roy Marples
1 On Fri, Feb 09, 2007 at 09:29:04AM +0000, Roy Marples wrote:
2 > On Fri, 09 Feb 2007 01:03:04 -0800
3 > Donnie Berkholz <dberkholz@g.o> wrote:
4 >
5 > > Jakub Moc wrote:
6 > > > Mike Frysinger napsal(a):
7 > > >> On Thursday 08 February 2007, Roy Marples wrote:
8 > > >>> The actual scripts themselves can be re-worked if they need to be
9 > > >>> - this problem only when the arrays are used in config files.
10 > > >> i guess my point was i think we really need to be consistent
11 > > >> here ... either arrays are OK for init.d scripts or they're not OK
12 > > >>
13 > > >> did you get a chance to see how hard it would be to integrate the
14 > > >> bash array code ?
15 > > >
16 > > > sys-apps/855resolution and sys-apps/915resolution use arrays in
17 > > > config files, and there's not much way around it ATM if you want to
18 > > > replace multiple BIOS modes...
19 > > >
20 > > > <snip>
21 > > > # to replace more than one mode do something like this
22 > > > #replace=(
23 > > > # "4d 1280 768 24"
24 > > > # "5c 1400 1050 16"
25 > > > #)
26 > >
27 > > How about this?
28 > >
29 > > replace="
30 > > '4d 1280 768 24'
31 > > '5c 1400 1050 16'
32 > > "
33 > >
34 >
35 > Actually, that may work better than my delimited with ; approach.
36 > We could then do
37 >
38 > eval set -- "${replace}"
39 > for x in "$@" ; do
40 > ....
41 > done
42
43 That works with your ; approach too, as well as with the
44 newline-separated approach:
45
46 replace="
47 4d 1280 768 24
48 5c 1400 1050 16
49 "
50
51 IFS=';
52 '
53 #set -f
54 set -- ${replace}
55 #set +f
56 unset IFS
57
58 for x ; do
59 ....
60 done

Replies

Subject Author
Re: [gentoo-dev] Network configuration and bash Roy Marples <uberlord@g.o>