I am having trouble with using inotifywait properly.
My environment is CentOS 8 Stream with i7-9700
test.sh
#!/bin/bash
inotifywait -e modify ./test.txt |
while read dirname eventlist filename
do
echo "Event catch!"
done
echo "I am doing next thing"
output in terminal(stdout)
[root@ceph examples]# sh test.sh
Setting up watches.
Watches established.
I am doing next thing
What I expect?
I expect that my script print the line, "Event catch!". As you can see, my bash script ignore all while loop block and just print "I am doing next thing".