bash_env: Avoid unnecessary re-writes

* Don't re-write the file unless needed.
* Should improve performance slightly.