I have two directories newdir and otherdir and would like to update a symlink, that initially pointed to otherdir to newdir.
When I run:
> ln -s otherdir symlink
I see a symlink:
> ls -al symlink
symlink -> otherdir
When I run:
> ln -sFf newdir symlink
I would expect symlink -> newdir, but I see the old link when I run:
> ls -al symlink
symlink -> otherdir
And I also noticed that a new symlink exists:
> ls -al symlink/newdir
symlink/newdir -> newdir
Is there a way to prevent ln from interpreting the destination path as parent directory ?
Or is the only way to prevent this from happening to remove the link first ?
Best Answer
Use the -h option: