title: Shell script issue with filenames containing spaces
body: <p>I understand that one technique for dealing with spaces in filenames is to enclose the file name with single quotes: "'".</p>
  
  <p>Why is it that the following code called, "echo.sh" works on a directory containing filenames with spaces, but the program "ls.sh" does Not work, where the only difference is 'echo' replaced with 'ls'?</p>
  
  <p>echo.sh</p>
  
  <pre><code>#!/bin/sh
  for f in *
  do
  echo "'$f'"
  done
  </code></pre>
  
  <p><strong>Produces</strong>:<br>
      'a b c' <br>
      'd e f' <br>
      'echo.sh' <br>
      'ls.sh' <br></p>
  
  <p>But, "ls.sh" fails:</p>
  
  <pre><code>#!/bin/sh
  for f in *
  do
  ls "'$f'"
  done
  </code></pre>
  
  <p><strong>Produces</strong>:<br>
      ls: cannot access 'a b c': No such file or directory <br>
      ls: cannot access 'd e f': No such file or directory <br>
      ls: cannot access 'echo.sh': No such file or directory <br>
      ls: cannot access 'ls.sh': No such file or directory <br></p>