The problem of having a parenthesis in the middle of a string should not be present in the current version, but of course I can be wrong.
On Wed, 2005-08-17 at 09:42 +0200, Knut Auvor Grythe wrote: > On Wed, Aug 17, 2005 at 07:56:58AM +0200, Mark Burgess wrote: > >> Well, when I say *exactly* I mean: > >> > >>> $(dollar)/&.conf/g\"")> > > > > But this does not have balanced quotes or parentheses, so it doesn't > > make much sense to me. You can't have a semi-quoted exoression > > in any language.. > > The problem is, as far as I can see, this: > > You have your weird oneliner with parentheses in it: > > someresult = ( ExecResult(/bin/sh "/bin/echo baz|/bin/sed -e > \"s/^\(.*\)$/&.conf/g\"") ) > > cfengine starts parsing it, and finds "ExecResult(". Okay, it thinks, > It'll Have to find the matching parenthesis. So it scans through the > string until it finds one. It finds one in the middle of the oneliner, > about here: > > ExecResult(/bin/sh "/bin/echo baz|/bin/sed -e \"s/^\(.*\)$/&.conf/g\"") > ^ > You'll notice that the string he is qouting is the remainder of his > oneliner, right after the parenthesis. > > As far as I can see, this would all be avoided if you were allowed to > quote the argument to ExecResult. That way, it wouldn't matter what was > in the argument, as long as it was quoted and the quotes inside it were > escaped. In other words, like this: > > someresult = ( ExecResult("/bin/echo \"this is a string (with parentheses) > for testing\"") > > I have not tested this, but I believe Steve said that wouldn't work. > > Also without having tested, I believe this hack would work: > > control: > command = ( "/bin/echo \"this is a string (with parentheses) for > testing\"" ) > someresult = ( ExecResult($(command)) ) > > It would be very nice to be able to write that in a single line, > especially since it seems you are allowed to quote the arguments to > functions in groups now. Being allowed to in groups is excellent, but it > would be even better if it was consistent :-) > > PS: I have no idea about how the parser really works here, and have done > no testing what so ever, simply assumed that what others say is > correct. If I say something wrong here, please forgive me. > _______________________________________________ Help-cfengine mailing list Help-cfengine@gnu.org http://lists.gnu.org/mailman/listinfo/help-cfengine