On 9/3/19, Greg Wooledge <wool...@eeg.ccf.org> wrote: > On Tue, Sep 03, 2019 at 04:17:01PM -0400, Lee wrote: >> Just out of curiosity, >> sed 's/foo/bar/g' file > tmpfile && sync && mv tmpfile file >> seems to be the 'more correct' version of >> sed 's/foo/bar/g' file > tmpfile && mv tmpfile file >> >> Do you ever take it that far or is the "slight risk of data loss in >> case of a system crash / power loss" so slight that you don't bother? > > That particular edit was made anonymously. > > https://mywiki.wooledge.org/BashPitfalls?action=diff&rev1=429&rev2=430 > > I'll admit I do not normally write scripts with that in mind. Shell > scripting is *hard*.
Yes, shell scripting is hard :( Thanks for making it a bit easier Lee > >