有没有办法编辑符号链接而不先删除它? [英] Is there a way to edit a symlink without deleting it first?
本文介绍了有没有办法编辑符号链接而不先删除它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我创建了一个符号链接:
So I created a symlink:
ln -s /location/to/link linkname
现在我想更改符号链接链接到的位置.我怎么做?有没有办法不用先删除呢?
Now I want to change the location that the symlink links to. How do I do that? is there a way to do it without deleting it first?
推荐答案
您可以使用不同的名称创建新链接,然后移动它以替换旧链接.
You could create the new link with a different name, then move it to replace the old link.
ln -s /location/to/link linkname
稍后
ln -s /location/to/link2 newlink
mv newlink linkname
如果 newlink
和 linkname
在同一个物理设备上,mv
应该是原子的.
If newlink
and linkname
are on the same physical device the mv
should be atomic.
这篇关于有没有办法编辑符号链接而不先删除它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文