>>I worked around this by doing variable=$(eval echo $(svcprop ...))
>>but this is really a bad workaround. What if the value contains shell meta's
>>that
>>I want to keep?, for example a password like "secret$ofjoost" will end up in
>>"secret".
Hi Stephen,
Actually, after re-thinking and trying: the workaround of
$(eval echo $(svcprop ..))
seemed to be acceptable. It would just 'eat' the escapes put
there by svcprop.
However, when I tried it, I stumbled on another thing. I configured a
variable named 'auth' with a value of
inter$al as {}&
It comes back from svcprop as
inter$al\ as\ {}\&
So, not all shell meta's are prefixed and thus the eval echo workaround
does not work if the string has some metacharacters not in the list of
quote_for_shell: const char * const metachars = ";&()|^<>\n \t\\\"\'`";
svccfg -s FMRI listprop options/auth | read name type value
is a better workaround.
> (The output was designed first for easy parsing in its columnar
> output, but we've since learned that as many people want to use the
> values as shell script fragments as any other application...)
If that's the case, quote_for_shell should only prefix blanks, tabs
and newlines...
So, we even more need an option to "not quote for shell" \:\-\) \!
Do I still get a mug now???
Regards, Joost