小编giZ*_*Zm0的帖子

为什么 ln -s 在创建到现有符号链接目录的符号链接时不告诉它失败?

运行时(在 linux 上不同的 ubuntu 变体):

>ln -s dir_1 symlink_dir
>ln -s dir_2 symlink_dir
Run Code Online (Sandbox Code Playgroud)

它失败了却没有说它失败了。但是,如果您对文件执行相同的操作,或者将 v 添加到选项中,它确实会告诉您它失败了:

>ln -s file_1 symlinkg_file
>ln -s file_2 symlinkg_file
Run Code Online (Sandbox Code Playgroud)

或者

>ln -sv dir_1 symlink_dir
>ln -sv dir_2 symlink_dir
Run Code Online (Sandbox Code Playgroud)

它失败并显示错误消息:

ln: failed to create symbolic link
Run Code Online (Sandbox Code Playgroud)

对我来说,这似乎是一种非常奇怪的行为?是否有一个原因?

linux command ln

7
推荐指数
1
解决办法
1万
查看次数

标签 统计

command ×1

linux ×1

ln ×1