inotifywait - exclude regex pattern formatting

后端 未结 6 828
抹茶落季
抹茶落季 2020-12-31 11:21

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

6条回答
  •  没有蜡笔的小新
    2020-12-31 12:08

    You could get most of this with --exclude '\.[^j][^s]' to ignore files unless they contain .js at some point in the filename or path. If you combine it with -r then it will work with arbitrary levels of nesting.

    Only drawback is filenames like test.js.old will still be watched and all files inside a directory called example.js/ will also be watched, but this is probably somewhat unlikely.

    You could probably extend this regex to fix this but personally I don't think the drawbacks are a big enough of a deal to worry about.

提交回复
热议问题