简体   繁体   English

如何创建指向它自己的符号链接 - linux

[英]how to create symbolic link that points to it self - linux

Has anyone succeed to create a symbolic link that point to it self? 有没有人成功创建一个指向它自己的符号链接? I tried to create a symlink to some file delete the real file and try to link to it self but got this error: 我试图创建一个符号链接到一些文件删除真实文件,并尝试链接到它自己,但得到此错误:

ln: creating symbolic link `********': File exists

I know its possible to create this symlink. 我知道可以创建这个符号链接。

You can create a symbolic link that points to itself with ln -s : 您可以使用ln -s创建指向自身的符号链接:

$ ln -s testlink testlink

$ ll testlink
lrwxrwxrwx 1 me myGroup 4 19 avr.  11:22 testlink -> testlink

However another file with the same name must not exist beforehand : 但是,事先不能存在具有相同名称的另一个文件:

$ touch testlink

$ln -s testlink testlink
ln: impossible de créer le lien symbolique « testlink »: File exists

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM