Mike Shapiro wrote: > On Wed, Jun 04, 2008 at 12:53:34AM -0500, Nicolas Williams wrote: > > svcprop(1) does a pretty heroic job of escaping shell metachars from > > property values. It's even heroic about newlines in property values > > > > Unfortunately the way it deals with multiple values ruins that heroism: > > > > % svcprop -t -c -p config someservice > > config/bar astring d\ > > \ c e > > % > > > > Quick: how many values is that? > > > > In my case it was *two*. Bet you couldn't tell. > > > > I'd rather svcprop(1) had an option to print multiple values like so: > > ... > > Please yes. What is desperately needed is the syntax to > reliably assign a ksh93 or bash array variable from a multi-valued > property *and* handle all the escapes and quoting etc.
See http://svn.genunix.org/repos/on/branches/ksh93/gisburn/scripts/svcproptree1.ksh for a possible solution. IMO I would add an option "-C" to "svcprop" which works like this: 1. "-C tree" will output a compound variable tree 2. "-C compound_list" will output the same tree as list 3. "-C name_array_list" will output these data as array (using a string as index) 4. "-C indexed_array_list" will output these data as array using a integer as index 5. <... any so on...> Note that this looks complex but isn't since the code and the data are always the same - we just reformat the output a bit to match the _consumers_ need. ---- Bye, Roland -- __ . . __ (o.\ \/ /.o) roland.mainz at nrubsig.org \__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer /O /==\ O\ TEL +49 641 7950090 (;O/ \/ \O;)