Linux終端下執(zhí)行,用于刪除無(wú)效的鏈接文件。
usage()
{
echo "RemoveBroken 0.1, a shell script to remove broken link files."
echo "License: MIT, (c) chenzhiqiang"
echo "Usage:"
echo " $0 --help print this help."
echo " $0 --path PATH broken links under this PATH will be removed."
echo " $0 --stdin read PATHs from stdin."
echo " $0 same as $0 --stdin."
}
fromStdin()
{
while [ 1==1 ]
do
read
[ "$REPLY" != "" ] || exit 0
[ ! -L $REPLY -o -e $REPLY ] || unlink $REPLY
done
}
fromPath()
{
find $2 | $0 --stdin
}
if [ $# = 0 ]
then
usage
fromStdin
exit 0
fi
case $1 in
--stdin)
fromStdin
--path)
find $2 | $0 --stdin
--help)
usage
*)
echo "RemoveBroken: unknown usage."
usage
esac
標(biāo)簽:馬鞍山 婁底 許昌 巴彥淖爾 邵陽(yáng) 淘寶邀評(píng) 金昌 赤峰
巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《linux刪除無(wú)效鏈接文件腳本分享》,本文關(guān)鍵詞 linux,刪除,無(wú)效,鏈接,文件,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。