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

首頁 > 系統 > Linux > 正文

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

2019-10-26 18:38:51
字體:
來源:轉載
供稿:網友

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

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 石嘴山市| 新绛县| 武定县| 和平县| 大化| 扬州市| 乳山市| 东源县| 韶山市| 高密市| 南陵县| 连云港市| 高邮市| 阿勒泰市| 凤翔县| 宁陕县| 安宁市| 泸定县| 莒南县| 察雅县| 兰溪市| 道真| 乐平市| 建湖县| 安多县| 宽城| 义乌市| 许昌县| 福泉市| 白银市| 合水县| 庄浪县| 婺源县| 朝阳县| 嘉黎县| 馆陶县| 西吉县| 丰都县| 合江县| 安福县| 新竹县|