我有以下运行 inotifywait 命令的 shell 脚本。我想在每次修改事件时将输出回显打印到控制台。
剧本:
#!/bin/sh
while inotifywait -e modify -r -m ./ --exclude '\.sh$'; do
echo test
done
当我更改指定目录中的一个文件时,我从 inotifywait 获得标准输出:
Setting up watches. Beware: since -r was given, this may take a while!
Watches established.
./postgres/ MODIFY postgres_test.go
./postgres/ MODIFY postgres_test.go
我有两个问题:
为什么修改的事件注册了两次?我只更新了一次文件。为什么“测试”没有打印到我正在运行脚本的控制台?