On Thu, 5 Jun 2014 10:02:42 -0700 (PDT) Ed <
ed.6...@gmail.com> wrote:
E> Is there any way a command with an argument enclosed in double quotes
E> can receive a double quote in that argument? Or a command with an
E> argument enclosed in single quotes can receive a single quote in that
E> argument?
E> I'm mainly interested in a Linux environment using noshell. Thanks for any
E> insights.
If noshell is a requirement, I found no workaround. With shell:
#+begin_src cfengine3
body common control
{
bundlesequence => { "quote_test" };
inputs => { "$(sys.libdir)/
stdlib.cf" };
}
bundle agent quote_test
{
commands:
'/bin/echo "in_shell double quote: \\" "' contain => in_shell;
"/bin/echo \"in_shell single quote \' \"" contain => in_shell;
'/bin/echo double quote: \\" ';
"/bin/echo single quote \\' ";
}
#+end_src
output:
#+begin_src text
2014-06-06T07:42:19-0400 notice: /default/quote_test/commands/'/bin/echo "in_shell double quote: \" "'[0]: Q: ".../bin/echo "in_s": in_shell double quote: "
2014-06-06T07:42:19-0400 notice: /default/quote_test/commands/'/bin/echo "in_shell single quote ' "'[0]: Q: ".../bin/echo "in_s": in_shell single quote '
2014-06-06T07:42:19-0400 notice: /default/quote_test/commands/'/bin/echo double quote: \" '[0]: Q: ".../bin/echo doubl": double quote: \"
2014-06-06T07:42:19-0400 notice: /default/quote_test/commands/'/bin/echo single quote \' '[0]: Q: ".../bin/echo singl": single quote \'
#+end_src
HTH
Ted