2016-11-07 15:40:15 +0000, Geoff Clare: [...] > > Same problem with "mv" (which I think would work just > > as well (with LC_ALL=C mv -i < /dev/null 2> /dev/null)) > > No, mv -i doesn't work just as well - it has a race condition. > If a file is created in between the existence check and the > rename() call, mv will remove the file.
How so? "mv -i" with /dev/null as stdin ("no" answer to prompt) is not supposed to remove anything. > > You could use "link" (Unix, not POSIX), or "ln -T" (GNU, not > > POSIX) or "mv -Tn" (GNU) instead. > > The standard allows systems to make "link" available only to > processes with appropriate privileges, so that solution might > not be sufficiently portable. [...] That seems to be in contradiction with it calling the link() system call. I suspect that text is there for attempts to call "link" on a directory.