4 ms·
The script should probably be using `mktemp` instead of potentially overwriting uninvolved files (even if they have `.tmp` in the name).
by aix1 5y ago
The script should probably be using `mktemp` instead of potentially overwriting uninvolved files (even if they have `.tmp` in the name).
- progval 5y agoWhen you do, just make sure you use the `--directory` option of `mktemp` to use the same directory as the final file. This makes sure both files are on the same filesystem, so `mv` is atomic (and faster).
- sdoering 5y agoAnd so I learned of mktemp today. Just was intrigued, googled it, read about it and know it solves a problem I had elegantly. Some new tool in my belt from now on. Thank you.
- tzs 5y agoFor a simple case like this I'd probably just go with something like tmp.$$.tmp.