I've had noclobber turned on for as long as I can remember across multiple shells. Every so often I'm annoyed when I copy/paste someone else's command to do something and it errors, but I much prefer it to data loss.
I've done exactly this since I started using Unix in the 1980s. A big residual cause (for me) of overwriting files accidentally was messing up the order of tar arguments. For common use cases, I have scripts which wrap tar up in cotton wool to prevent such mishaps.
I have it set in my .bashrc so it's always there. Otherwise I tend to aim at my foot and shoot way too often. As I've been using CLIs for some 50 years, only Unix derived OSes' file semantics let you overwrite a file while it's open for read. Windows (much as I hate it) doesn't.
Comments