fabric/fabric — pull request #994 by mgedmin (2013-10-12 08:49:21+00:00)
Title: append() reappends existing lines when I use shell_env()

I had a fabfile like this:
```
@task
def foo():
with settings(shell_env(LC_ALL='C.UTF-8')):
# other stuff
append('/root/.ssh/known_hosts', ssh_host_key, use_sudo=True)
```
and noticed that it would append the SSH host key every single time.

Some debugging with pdb lead me to discover that `contains()` ends up running `sudo(egrep_cmd, shell=False)`, which fails with `sudo: export: command not found`. That error is quietly suppressed, and append assumes the line needs to be added.