If I interrupt
sed (stream editor) is there any chance of corrupting the target file?
Example: If I run the command
sed -i -- 's/foo/bar/g' file.txt, and kill it before it finishes, is there any chance that the string
foo will be replaced by some text other than
bar or even corrupting the target file?
What I would expect is that if I kill before the file handler is flushed, then there is a chance of unfinished replacement being in the file. However, I have a feeling that
sed is robust for such events, by using some kind of intermediate files before modifying the target. But, I couldn't find details in the documentation.