Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 incron 来监视目录中的事件,但我想排除某些子目录或某些文件名 PATTERNS。
有没有办法优雅地做到这一点?
Incron 不支持模式过滤器,因此您需要实现自己的过滤器。
一个文件扩展名的简单示例可能是:
Incrontab:
/watched/directory IN_ALL_EVENTS /usr/local/bin/incronfilter .pyc $# /bin/echo $@/$# $& $%
incron过滤器:
#!/bin/bash ext=$1 file=$2 shift 2 [ "$file" == "${file%$ext}" ] && $*
希望能帮助到你。