title: Computer does not shut down when script running in while loop
body: <p>I've put this script in /etc/init.d, when some user changes password, this script updates it on another file data.txt, It is working fine, but when i shut down my computer it was not doing so showing ubutnu screen at shutting down, n when i shut down it manually it automatically restarts itself, </p>
  
  <p>By removing this script and commenting outer while loop, computer can easily be shut down.</p>
  
  <p>Here is my code </p>
  
  <pre><code>while inotifywait -e attrib /etc/shadow; do
           #edit user
              while IFS=: read -r f1 f2
                  do
                  user=$(sudo grep "$f1" /etc/shadow | cut -d':' -f 1);
                  pwd=$(sudo grep "$f1" /etc/shadow | cut -d':' -f 2);
                      if [ "$f2" != "$pwd" ]; then
                      #echo "changed";
                      #search for password, and repalce it with new one
                      sed -i 's@'$f2'@'$pwd'@' $file;
                      #upload file data.txt to server         
                      fi
              done &lt; $file
          #end edit user
      done
  </code></pre>
  
  <p>Please tell me what I'm doing wrong?</p>