#!/bin/bash
func (){
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/$f
fi
elif [ -d "$dir/$f" ]
then
# echo "$dir/$f is dir."
func "$dir/$f" # 如果是目录, 则再次进行遍历
else
echo "$dir/$f unknown."
fi
done
}
func .
量化交易之linux篇 - shell脚本 - 删除当前文件夹下的所有可执行文件(且不包括shell脚本)
最新推荐文章于 2023-08-14 15:22:19 发布