I am trying to (as close as possibly) atomically change a symlink. I've tried:
ln -sf other_dir existing_symlink
That just put the new symlink in the directory that existing_symlink pointed to.
ln -sf other_dir new_symlink
mv -f new_symlink existing_symlink
That did the same thing: it moved the symlink into the directory.
cp -s other_dir existing_symlink
It refuses because it's a directory.
I've read that mv -T
is was made for this, but busybox doesn't have the -T
flag.
mv -T
option since 1.34.0, see busybox.net and git.busybox.net/busybox/commit/coreutils/mv.c?id=91bc01c5