On Tue, Sep 03, 2019 at 09:54:21AM -0400, Greg Wooledge wrote: > On Sat, Aug 31, 2019 at 06:28:15PM +0200, to...@tuxteam.de wrote: > > Me too, I didn't know about sponge. Small, nifty utility, doing one > > thing -- pretty Unixy. > > Oh god, no. Don't use sponge unless you enjoy data loss. > > See <https://mywiki.wooledge.org/BashPitfalls#pf13>.
There are two possible issues there: - sponge doesn't close its stdin before writing to 'file'. This would be a downright error, but easy to check. - the issue with a crash you mention in your article (nicely written articles, BTW -- thanks for them!): well, don't do it on a "precious" file: better keep a copy around. But that would be general sound advice while mucking around with an interactive shell near your data, anyway :-) I don't think I'd use sponge in "real" scripts, but for interactive mucking around and one-offs it still seems handy. And remember, kids -- do your backups :-) Cheers -- t
signature.asc
Description: Digital signature