Gentoo Archives: gentoo-dev

From: Roy Marples <roy@×××××××.name>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] How to pass list of paths to eclass?
Date: Tue, 11 Dec 2007 11:36:39
Message-Id: 200712111133.50571.roy@marples.name
In Reply to: Re: [gentoo-dev] How to pass list of paths to eclass? by Peter Volkov
1 On Tuesday 11 December 2007 11:14:49 Peter Volkov wrote:
2 > > That way you work the same way as the classic $PATH variable.
3 >
4 > But this seems to fail if we have ':' inside path{1,2}. Is that true?
5 > For PATH the same question stands, but I think that ':' is used there
6 > for historical reasons.
7
8 Yes, that does mean you cannot use : in PATH.
9 I don't actually know if shells allow it to be escaped, but I do know that
10 escaping does not work when IFS is concerned.
11
12 You could also use the embedded newline approach that Donnie mentioned
13 earlier, but you may or may not want to go there. It's it's fairly ugly code.
14 But the good news is you can now escape anything into an item, and remian
15 shell portable. Here's a code snippet
16
17 FONT_CONF="conf1
18 conf2"
19
20 SIFS="${IFS-y}" OIFS="${IFS}"
21 IFS="
22 "
23 for for conffile in ${FONT_CONF}; do
24 ....
25 done
26 if [ "${SIFS}" = "y" ]; then
27    unset IFS
28 else
29    IFS="${OIFS}"
30 fi
31
32 Oddly enough, you do need to quote variable assignment now as in my test even
33 bash got it wrong. Probably a bug, but heh.
34
35 Thanks
36
37 Roy
38 --
39 gentoo-dev@g.o mailing list