国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > Linux Shell > 正文

linux刪除無效鏈接文件腳本分享

2020-07-27 19:18:57
字體:
來源:轉載
供稿:網友

Linux終端下執行,用于刪除無效的鏈接文件。

復制代碼 代碼如下:

#!/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

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 原平市| 理塘县| 泸州市| 汽车| 新邵县| 仁怀市| 侯马市| 望奎县| 连云港市| 镇平县| 陆丰市| 鄯善县| 洪雅县| 崇州市| 东兰县| 武城县| 依安县| 斗六市| 巴南区| 辉南县| 吉木萨尔县| 丹寨县| 顺义区| 紫金县| 易门县| 北辰区| 洛阳市| 桃源县| 和政县| 望都县| 灯塔市| 饶河县| 兴城市| 深泽县| 大港区| 海口市| 博野县| 涟水县| 江油市| 阿尔山市| 特克斯县|