Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
为什么echo "---" >> file只生成一个./ OPEN file事件?它不应该也产生其他事件吗?
echo "---" >> file
./ OPEN file
例如:
# In a script: while true; do change=$(inotifywait -q -r . ) echo $change done # Somewhere else: echo "--" >> file echo "--" >> file echo "--" >> file
它在第一个事件之后退出并重新开始循环,当第一个手表被移除和第二个手表被添加时,事件已经发生了。你可以试试:
inotifywait -q -m -r . | while read CHANGE; do case "$CHANGE" in *)echo $CHANGE;; esac done
-m 将在第一个事件之后继续监控