local dir="$1" #local局部变量标识符 for f in `ls $1` do if [ -f "$dir/$f" ] then # echo "$dir/$f is file." if test -x $dir/$f && [ ${f##*.} != "sh" ] # 判断文件是否为 可执行文件, 且过滤掉 shell 脚本. then echo "$dir/$f is exe file." rm -f $dir/$...
Linux shell脚本删除某个文件夹下所有文件 #!/bin/bash dir="对应需要删除文件夹" files=`ls ${dir}` for file in $files do if [ -e ${dir}/${file} ] then rm -rf ${dir}/${file} fi done
求一道linux shell脚本题目的解答 查找一个文件夹下所有文件,比较文件内容,删除同样的文件文件夹路径是shell脚本的参数,如果两个regular file内容相同,则保留字母顺序靠前的一个,删除