哇,我以前从来没有真正使用过符号链接,但这真是令人难以置信:
bash-3.2$echo "weird" > original.txt bash-3.2$mkdir originals bash-3.2$mv original.txt originals/ bash-3.2$cat originals/original.txt weird bash-3.2$mkdir copies bash-3.2$ln -s originals/original.txt copies/copy.txt bash-3.2$cat copies/copy.txt cat: copies/copy.txt: No such file or directory bash-3.2$ls copies/copy.txt copies/copy.txt bash-3.2$ls -l copies/copy.txt lrwxr-xr-x 1 zach staff 22 Dec 22 01:23 copies/copy.txt -> originals/original.txt bash-3.2$cat originals/original.txt weird bash-3.2$cat copies/copy.txt cat: copies/copy.txt: No such file or directory bash-3.2$cd copies/ bash-3.2$cat copy.txt cat: copy.txt: No such file or directory
为什么我不能在复制目录中捕获符号链接?
如果我从副本中创建符号链接,我可以很好地捕捉它.如果我在当前目录中创建符号链接,我也可以很好地捕捉它.如果我在当前目录中创建符号链接然后将其移动到副本/,我会得到“copies / copy.txt:没有这样的文件或目录”.