inotifywait - 排除正则表达式的格式 [英] inotifywait - exclude regex pattern formatting

查看:563
本文介绍了inotifywait - 排除正则表达式的格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 inotifywait 观看所有的的.js 下的文件,我的 〜/ JS 目录;我怎么格式化以下命令里面我正则表达式?

$ inotifywait -m -r --exclude [REGEX这里]〜/ JS

正则表达式 - 根据手册页,应该是POSIX的扩展正前pression - 需要匹配的所有文件,除了那些在 的.js 的,所以这些文件又可以通过被排除在外 - 排除选项

我试过了(?!)环视的事情,但它似乎并没有在这种情况下工作。任何意见或解决方法?请问多少AP preciate你对这个问题的帮助。


解决方案

  

我试过了(?!)的事情


这件事被称为负超前,它不是由POSIX ERE支持。

所以,你必须做硬盘的方式,即匹配要排除一切。

例如。

\\。(TXT | XML)

I am trying to use inotifywait to watch all .js files under my ~/js directory; how do I format my regex inside the following command?

$ inotifywait -m -r --exclude [REGEX HERE] ~/js

The regex - according to the man page, should be of POSIX extended regular expression - needs to match "all files except those that ends in .js", so these files can in turn be excluded by the --exclude option.

I've tried the (?!) lookaround thing, but it doesn't seem to work in this case. Any ideas or workarounds? Would much appreciate your help on this issue.

解决方案

I've tried the (?!) thing

This thing is called negative lookahead and it is not supported by POSIX ERE.

So you have to do it the hard way, i.e. match everything that you want to exclude.

e.g.

\.(txt|xml) etc.

这篇关于inotifywait - 排除正则表达式的格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆