saltstack/salt — pull request #5498 by ageron (2013-06-12 14:01:00+00:00)
Title: Fix documentation bug in cmdmod.py (lacked an escape in code examples)

The examples were incorrect:

salt '*' cmd.run "ls -l | awk '/foo/{print $2}'"

The `$2` would be interpreted by the shell before being passed to the `salt` command. So it would actually receive these parameters:

['*', 'cmd.run', "ls -l | awk '/foo/{print }'"]

Not what you would expect.

There are two possible solutions:

salt '*' cmd.run "ls -l | awk '/foo/{print \$2}'"
salt '*' cmd.run 'ls -l | awk "/foo/{print \$2}"'

I chose the former.