我使用fswatch在文件更改时采取一些措施。我使用以下命令:
fswatch -o -r '.' | while read MODFILE
do
echo 'Some file changed, so take some action'
done
这很好用,如果我更改几个文件,我会在终端中看到以下内容:
Some file changed, so take some action
Some file changed, so take some action
Some file changed, so take some action
etc.
但我也想知道哪个文件实际上导致了这个动作。所以我检查了 fswatch 手册页,它显示了以下内容:
fswatch writes a record for each event it receives containing:
- The timestamp when the event was received (optionally).
- The path affected by the current event.
- A space-separated list of event types (see EVENT TYPES ).
但正如我所说,我的终端中没有列出任何内容。有谁知道我如何显示“受当前事件影响的路径。 ”?
欢迎所有提示!