[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Assoc array keys
From: |
Chip Seraphine |
Subject: |
Assoc array keys |
Date: |
Wed, 11 Aug 2004 15:01:38 -0500 |
User-agent: |
KMail/1.5.4 |
Is there any way of extracting the keys from an associated array?
I'm considering writing some cfengine code to manage init.d services. I can
build the array like this using the newfangled A() stuff:
any::
services= ( A(cfengine-servd,on) A(telnet,off) )
linux.webserver::
services= ( A(httpd,on) )
solaris.webserver::
services= ( A(apache,on) )
!webserver::
services= ( A(httpd,off) )
...and so forth. This seems to work fine and builds me a nice array; what I
am lacking is the ability to do anything with it without (a) calling an
external script or (b) assuming my list of services. I'd love to do this:
shellcommands:
linux::
"/sbin/chkconfig ${magicvalue}"
...where ${magicvalue} could be an iterator that expanded to key and value
(seperated by a magic $(keydelim) variable or whatever) each time. I could
then set $(keydelim) to $(spc) and I'm off to the races.
Anybody have any clever ideas on how to do this? Or at leat how to pass an
intact assoc array to a shellcommand? Failing any of the above, any interest
in implementing it? (This is too low-level for my meager C skills, sadly.)
--
Chip Seraphine
Unix Administrator
TradeLink, LLC
312-264-2048
chip@trdlnk.com
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Assoc array keys,
Chip Seraphine <=