特定のディレクトリ「/root/secondfolder/」を監視するbashスクリプトを作成しました。スクリプトは次のとおりです。
#!/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
誰かが私を正しい方向に向けることができますか?