some_cmd >foo.tmp && mv foo.tmp foo
Your mechanism is clearly safer, but the user is required to clean up `foo.tmp` themselves in case of failure, so it's not really comparable.