小编c.s*_*kun的帖子

git 和 git-core 包之间有什么区别?

为什么有一个git包和一个git-core包?有什么区别吗?

git version-control

62
推荐指数
1
解决办法
3万
查看次数

Bash 脚本的问题

我想编写一个简单的脚本来检测由 Windows 病毒创建的文件。通常它会创建一个 .exe 文件,与它放置的目录同名。

这是脚本。只有在路径名不包含\n 时才有效。有人可以帮我修复这个脚本,拜托!

#!/bin/bash
if [ $# == 0 ]; then
    echo ""
    echo "==== Give me a directory to begin with! ===="
    echo ""
    exit
fi

for f in `find $1 -name '*.exe'` ; do
    filename=`basename "$f" .exe`
    dir_name=`dirname "$f"`
    current_dir_name=`basename "$dir_name"`

    if [ $filename == $current_dir_name ]; then
        rm -f "$f"  # It can't remove files 
                    # where the path contains spaces or \n ??!!
    fi
done
Run Code Online (Sandbox Code Playgroud)

bash find

1
推荐指数
1
解决办法
2081
查看次数

标签 统计

bash ×1

find ×1

git ×1

version-control ×1