Linux:在文件保存时触发Shell命令 [英] Linux: Triggering Shell Command On File Save

查看:198
本文介绍了Linux:在文件保存时触发Shell命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在修改文件时自动触发一个shell命令。我认为这可以在代码中通过注册一个inotify钩子和调用 system 来实现,但是是否有更高级别的bash命令可以实现这个功能?

I want to automatically trigger a shell command when a file is modified. I think this can be accomplished in code by registering an inotify hook and call to system, however is there a higher level bash command that can accomplish this?

推荐答案

尝试inotify-tools。我在复制链接时遇到了问题(对不起),但是在GitHub上有一个wiki,yu应该可以通过G-search-engine找到。

Try inotify-tools. I'm having problems copying the link (sorry), but there is a wiki on GitHub which yu should be able to find with G-search-engine.

这篇关于Linux:在文件保存时触发Shell命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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