0

I am trying to create a symbolic link on the server with the command ln -s,

Option 1:

ln -s /home/thejobco/public_html/JCCore/ajax_search /home/thejobco/public_html/demo/typo3conf/ext/

result 1:

ajax_search -> /home/thejobco/public_html/JCCore/ajax_search

Option 2:

ln -s /home/thejobco/public_html/JCCore/ajax_search/ /home/thejobco/public_html/demo/typo3conf/ext/

result 2:

ajax_search -> /home/thejobco/public_html/JCCore/ajax_search/

Question:

I want to know if the above two options are the same, or there is different between them? Option 1 does not have /, option 2 has /, but both of them work well, so just wonder which is the standard way?

4

1 回答 1

4

符号链接被实现为包含目标名称的文件。

正如您所看到的,有一个细微的差别:一个符号链接有一个尾随/,而另一个没有。您可以看到输出的差异ls -l;在较低级别上,这显示为readlink()系统调用返回的路径的差异。

但是它们之间应该没有功能差异——只要目标是一个目录。两者都可用于访问链接目录。

对于不是目录的目标,这是:

ln -s /etc/motd good_link
ln -s /etc/motd/ bad_link

将导致good_link成为一种有效的访问方式/etc/motd,并bad_link导致not a directory错误。

于 2013-08-10T01:51:08.183 回答