I would like to run the number of modify option in the monitored directory and when 3 modify event happened. I would like to run an command.
I have tried the code as shown below, however count variable is not increasing even though modification event happened.
#!/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
The issue is in the
let
statement. You can replace it with:This answer can also be useful