Partial fix for LP-1351089
Merge pull request #450 from johnweldon/lp-1351089

Partial fix for LP-1351089

If the environment has `set -o noclobber` then `cat > $TMPFILE` will fail if $TMPFILE exists.

The test referenced in [lp-1351089](https://bugs.launchpad.net/juju-core/+bug/1351089) should still be isolated better from the environment, but this seems like a good change to make anyway.