title: Using inotify in a script to monitor a directory
body: <p>I have written a bash script to monitor a particular directory "/root/secondfolder/" the script is as follows:</p>
  
  <pre><code>#!/bin/sh
  
  while inotifywait -mr -e close_write "/root/secondfolder/"
  do
      echo "close_write"
  done
  </code></pre>
  
  <p>When I create a file called "fourth.txt" in "/root/secondfolder/" and write stuff to it, save and close it, it outputs the following but it does not echo "close_write":</p>
  
  <pre><code>/root/secondfolder/ CLOSE_WRITE,CLOSE fourth.txt
  </code></pre>
  
  <p>can someone point me in the right direction?</p>