On Fri, Jun 13, 2008 at 01:24:21PM -0700, Jordan Brown wrote: > David Bustos wrote: > >What happens if you don't use eval? > > Nico and I spent some time looking at non-eval strategies, and weren't > able to come up with anything that had all the right semantics: > protecting special characters (wild cards, white space, newlines, et > cetera) in values, while allowing multiple values to be returned and > processed unambiguously. > > The big problem was that (simplifying) > echo `some_command` > processes shell wild cards in the output from some_command, with no way > to quote them, and > echo "`some_command`" > does not allow unambiguous representation of multiple values, > potentially with embedded white space. I think there were other issues too.
What Jordan said. Basically, I was able to get all quoting right for the eval case. The svcprop ... | while read ... case can also be made to work, with only newline quoting being problematic (and the solution simple enough). For the eval case quoting should be as follows: put values in single quotes, and quote any single-quotes in the values as I described on the dladm parseability thread (basically, close the single quote then use double quotes to add the to-be-quoted single quote, then re-open the single quote). For the svcprop ... | while read ... case all no quoting is needed, just an indication of whether / how many more reads are needed to read the whole value due to embedded newlines. Nico --