普通网友 2016-01-08 10:40
浏览 72

正则表达式与inotifywait在golang中编译两种类型的文件

I use a script to auto-compile in golang with inotifywait. But this script only checks files with the extension .go. I want to also add the .tmpl extension but the script uses regular expressions. What kind of changes I have to make to this line to get the desired result?

inotifywait -q -m -r -e close_write -e moved_to --exclude '[^g][^o]$' $1

I've tried to concatenate with | or & and other things like ([^t][^m][^p][^l]|[^g][^o])$ but nothing seems to work.

  • 写回答

1条回答 默认 最新

  • dqys98341 2016-01-08 10:59
    关注

    Rather than trying to use a regex to exclude two types of file, why don't you just only watch those files?

    inotifywait -q -m -r -e close_write -e moved_to /path/**/*.{go,tmpl}
    

    To use the ** (which does a recursive match), you may have to enable bash's globstar:

    shopt -s globstar
    
    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料