我写了一个bash脚本来监控特定目录“/root/secondfolder/”,脚本如下:
#!/bin/sh
while inotifywait -mr -e close_write "/root/secondfolder/"
do
echo "close_write"
done
当我在“/root/secondfolder/”中创建一个名为“fourth.txt”的文件并向其写入内容、保存并关闭它时,它会输出以下内容,但不会回显“close_write”:
/root/secondfolder/ CLOSE_WRITE,CLOSE fourth.txt
有人能指出我正确的方向吗?