<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -6,7 +6,7 @@ Operations
     :members:
     :exclude-members: sudo, put, run, get
 
-    .. autofunction:: sudo(command, shell=True, user=None, pty=False)
+    .. autofunction:: get(remote_path, local_path)
     .. autofunction:: put(local_path, remote_path, mode=None)
     .. autofunction:: run(command, shell=True, pty=False)
-    .. autofunction:: get(remote_path, local_path)
+    .. autofunction:: sudo(command, shell=True, pty=False,user=None)</diff>
      <filename>docs/api/operations.rst</filename>
    </modified>
    <modified>
      <diff>@@ -389,17 +389,16 @@ def _shell_wrap(command, shell=True, sudo_prefix=None):
     &quot;&quot;&quot;
     Conditionally wrap given command in env.shell (while honoring sudo.)
     &quot;&quot;&quot;
-    # Do shell escaping here and only here.
-    command = _shell_escape(command)
     # Sudo plus space, or empty string
     if sudo_prefix is None:
         sudo_prefix = &quot;&quot;
     else:
         sudo_prefix += &quot; &quot;
-    # Shell plus space, or empty string; and command quoted or not.
+    # If we're shell wrapping, prefix shell and space, escape the command and
+    # then quote it. Otherwise, empty string.
     if shell:
         shell = env.shell + &quot; &quot;
-        command = '&quot;%s&quot;' % command
+        command = '&quot;%s&quot;' % _shell_escape(command)
     else:
         shell = &quot;&quot;
     # Resulting string should now have correct formatting
@@ -520,8 +519,8 @@ def run(command, shell=True, pty=False):
     If ``shell`` is True (the default), `run` will execute the given command
     string via a shell interpreter, the value of which may be controlled by
     setting ``env.shell`` (defaulting to something similar to ``/bin/bash -l -c
-    &quot;&lt;command&gt;&quot;``.) Any double-quote (``&quot;``) characters in ``command`` will be
-    automatically escaped when ``shell`` is True.
+    &quot;&lt;command&gt;&quot;``.) Any double-quote (``&quot;``) or dollar-sign (``$``) characters
+    in ``command`` will be automatically escaped when ``shell`` is True.
 
     `run` will return the result of the remote program's stdout as a
     single (likely multiline) string. This string will exhibit a ``failed``</diff>
      <filename>fabric/operations.py</filename>
    </modified>
    <modified>
      <diff>@@ -139,12 +139,23 @@ def test_shell_wrap():
         del eq_.description
 
 
-def test_shell_wrap_escapes_command():
+def test_shell_wrap_escapes_command_if_shell_is_true():
     &quot;&quot;&quot;
-    _shell_wrap() escapes given command
+    _shell_wrap() escapes given command if shell=True
     &quot;&quot;&quot;
     cmd = &quot;cd \&quot;Application Support\&quot;&quot;
-    eq_(_shell_wrap(cmd, shell=False), _shell_escape(cmd))
+    eq_(
+        _shell_wrap(cmd, shell=True),
+        '%s &quot;%s&quot;' % (env.shell, _shell_escape(cmd))
+    )
+
+
+def test_shell_wrap_does_not_escape_command_if_shell_is_false():
+    &quot;&quot;&quot;
+    _shell_wrap() does no escaping if shell=False
+    &quot;&quot;&quot;
+    cmd = &quot;cd \&quot;Application Support\&quot;&quot;
+    eq_(_shell_wrap(cmd, shell=False), cmd)
 
 
 def test_shell_escape_escapes_doublequotes():</diff>
      <filename>tests/test_operations.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f6eac33fe8ab1e7e2ed10665a9c149ae93a9491a</id>
    </parent>
  </parents>
  <author>
    <name>Jeff Forcier</name>
    <email>jeff@bitprophet.org</email>
  </author>
  <url>http://github.com/karmazilla/fabric/commit/90fc395de3c9da2e6d670aa3b433da2bd683485a</url>
  <id>90fc395de3c9da2e6d670aa3b433da2bd683485a</id>
  <committed-date>2009-09-17T09:10:35-07:00</committed-date>
  <authored-date>2009-09-17T09:10:35-07:00</authored-date>
  <message>Fix escape logic so behavior == docstring.</message>
  <tree>71c15c79cf46ccdd44c26f3d6b86c8b1cda78979</tree>
  <committer>
    <name>Jeff Forcier</name>
    <email>jeff@bitprophet.org</email>
  </committer>
</commit>
