【发布时间】:2021-01-31 19:28:00
【问题描述】:
我想在监控目录中运行修改次数选项以及何时发生 3 个修改事件。我想运行一个命令。
我已经尝试了如下所示的代码,但是即使发生了修改事件,计数变量也没有增加。
#!/bin/bash
count=0
while :
do
{ inotifywait -m -q -e modify /home/testDir& let count="$count + 1"; } || exit 1
if [ "$count" -eq "3" ]; then
#Do something
count=-250
fi
done
【问题讨论】:
标签: linux bash shell command-line inotifywait