On Wed, Jun 04, 2008 at 02:41:25PM -0500, Nicolas Williams wrote:
> If I understand your proposal you're suggestion one svcprop invocation

I hate my typos.

> to find how many values for a property, and then a per-value invocation
> of svcprop.  Sounds rather wasteful (lots of fork/execs), though that
> too will do -- but think about how you use that from a shell program and
> compare to my usage above.

Let me save you the time :)

i=$(svcprop -C -p config/foo ...)
while [[ $i -gt 0 ]]
do
        value=$(svcprop -I $i -p config/foo ...)
        ...
done

vs.

svcprop -m -p config/foo ...|while readprop
do
        ...
done

Comparable, but the latter is clearly cheaper (one execution of svprop
vs. N+1).

Functions like readprop could be provided in a shell function library
(SMF already has something like that).

And this:

foo=($(svcprop -o ksh93-compound ...) )

is also a single invocation, but it can slurp in all of a repository's
contents (OK, most) if you want into one ksh93 structure in one go; no
shell functions needed.

So in terms of usage, I'd rank these as:

 - svcprop -o <format> is simplest to use (but hardest to implement)
 - svcprop -m is next simplest to use, assuming 'readprop' is provided
   in a shell function library
 - svcprop -C/-I is about as simple, but more expensive

-m/-C/-I are easy to implement.  -o is harder, but I like it too.

I'll write up a fasttrack and submit it.  Then we'll see what we decide
to do.

Nico
-- 

Reply via email to