-1
我想硬链接一个目录到不同的目录,但是这个脚本不起作用。由于一些奇怪的原因,它硬链接到所有的目录。所以“tv show dir”被硬连接到'moviesdestpath','tvdestdestpath'和'miscdestpath'bash硬链接不起作用
有什么想法吗?
#!/bin/bash
tvdestpath="/rpn-san/downloads/complete/torrents/tvshows-ready/$2"
moviedestpath="/rpn-san/downloads/complete/torrents/movies-ready/$2"
miscdestpath="/rpn-san/downloads/complete/torrents/misc-ready/$2"
torrentid="$1"
torrentname="$2"
torrentpath="$3"
torrentdir="$torrentpath/$torrentname"
#hardlink to "tvshows-ready"
cp -al "$torrentdir" "$tvdestpath/"
sleep 5
cp -al "$torrentdir" "$moviesdestpath/"
sleep 5
cp -al "$torrentdir" "$miscdestpath/"
请看看:http://www.shellcheck.net/ – Cyrus
我不熟悉“cp”的'-l'选项。你使用的是什么版本的linux? – Beta
Linux不允许硬链接到目录。 – Barmar