源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

linux删除无效链接文件脚本分享

  • 时间:2020-07-30 20:20 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:linux删除无效链接文件脚本分享
Linux终端下执行,用于删除无效的链接文件。
[u]复制代码[/u] 代码如下:
#!/bin/sh 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
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部