手机
当前位置:查字典教程网 >脚本专栏 >linuxshell >linux删除无效链接文件脚本分享
linux删除无效链接文件脚本分享
摘要:Linux终端下执行,用于删除无效的链接文件。复制代码代码如下:#!/bin/shusage(){echo"RemoveBroken0.1,...

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

【linux删除无效链接文件脚本分享】相关文章:

linux仿写chmod命令

linux中常用脚本和函数分享

Linux du命令查看文件夹大小并按降序排列

svn服务器启动和svn服务器重启、停止等操作脚本分享

Linux下统计当前文件夹下的文件个数、目录个数

自动生成linux网卡配置脚本分享

sed删除文件中的一行内容的脚本代码

linux数据库备份并通过ftp上传脚本分享

获取shell脚本自身所在目录的Shell脚本分享

linux中批量修改文件名的脚本代码

精品推荐
分类导航