title: ShellCheck warning: "Iterating over ls output is fragile. Use globs. [SC2045]"
body: <p>I am getting a ShellCheck warning [SC2045] for the second line in the code below. Is it fine to ignore it as I am making sure the directory is not empty before I try the last <code>ls</code>?</p>
  
  <pre><code> if [ "$(ls -A "$retryDir")" ]  ; then
      for thisRetryFile in $(ls "$retryDir"/*.tar.gz) ; do
          scp -o ConnectTimeout=30  "$thisRetryFile"  \             
                "$remoteUser@$remoteHost:$remotePath" &gt;&gt; "$BACKUPLOG"
      done
   fi
  </code></pre>
  
  <p><strong>UPDATE:</strong>
  After reading the post comments. I have changed the line to:</p>
  
  <pre><code>for thisRetryFile in "$retryDir"/*.tar.gz ; do
  </code></pre>
  
  <p>This has removed the warnings.</p>