3 ms·
Within a shell script context, 'mktemp' and 'mv' are almost always what you want, possibly 'ln -s' for libraries. The first safely creates a temporary file. T
by dredmorbius 7y ago
Within a shell script context, 'mktemp' and 'mv' are almost always what you want, possibly 'ln -s' for libraries.
The first safely creates a temporary file. The second (with noclobber set or -n argument) will atomically rename a file, but not overwrite existing contents.
Linux uses symlinks to system library files in order to allow in-place atomic replavement without affecting running processes with open filehandles to earlier versions. MS Window's lack of this feature is what makes (or made, I'm very out of date) malware removal and system updates so painful.
- CameronNemo 7y ago>Linux uses symlinks to system library files in order to allow in-place atomic replavement without affecting running processes with open filehandles to earlier versions Nope. If you rm a library, the processes using that library keep using the old library. Symlinks have nothing to do with it.