如何为一个文件创建多个软链接?

uc5*_*ore 4 command-line bash scripts symbolic-link

我将如何创建一个符号链接来创建指向一个文件的多个链接?

我想~/Desktop/foo.txt在多个地点“出现”;并且以下不起作用:

ln -s ~/Desktop/foo.txt /location/one /location/two
Run Code Online (Sandbox Code Playgroud)

gle*_*man 7

检查手册页——您只能指定一个目的地。你必须循环:

for destination in /location/one /location/two ...; do
    ln -s ~/Desktop/foo "$destination"
done
Run Code Online (Sandbox Code Playgroud)