You’re implying that all uses of `sponge` are interactive with a user actively involved.
I used sponge a lot in scripts where I’ve already checked and validated its behavior. When I’m confident it works I can keep just use sponge for simplicity.
Perhaps the backups are a separate process, run beforehand or after this process once several changes (perhaps to several files) have been made, so not backing up intermediate states?
Backups should be handled by an external process, otherwise, your script also needs to take into account:
- Number of backups to retain and cleaning up old versions
- Monitoring of backups. What if backing up fails?
- The script itself can tamper with the backups unintentionally?
I used sponge a lot in scripts where I’ve already checked and validated its behavior. When I’m confident it works I can keep just use sponge for simplicity.