脚本宝典收集整理的这篇文章主要介绍了linux删除无效链接文件脚本分享,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
Linux终端下执行,用于删除无效的链接文件。
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
以上是脚本宝典为你收集整理的linux删除无效链接文件脚本分享全部内容,希望文章能够帮你解决linux删除无效链接文件脚本分享所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。