title: read the contents of a directory using shell script
body: <p>I'm trying to get the contents of a directory using shell script.</p>
  
  <p>My script is:</p>
  
  <pre><code>for entry in `ls`; do
      echo $entry
  done
  </code></pre>
  
  <p>However, my current directory contains many files with whitespaces in their names. In that case, this script fails.</p>
  
  <p>What is the correct way to loop over the contents of a directory in shell scripting? </p>
  
  <p>PS: I use bash.</p>