title: Bash script errors: i in for loop gives 'no such file or directory'
body: <p>Long story short, I need to write a shell script. The script will take a single command line argument which will be a directory path.
  The script will then read each of the files in that directory and output it to standard output; the output will be in HTML and will be a table.</p>
  
  <p>The files will be in this format:</p>
  
  <pre><code>owner sysadmin group
  admin ajr
  loc S-309
  ser 18r97
  comment noisy fan
  </code></pre>
  
  <p>What I have so far:</p>
  
  <pre><code>PATH=/bin:/usr/bin
  
  cd "$@"
  if [ test $? -ne 0]
  then 
      exit 1
  fi
  
  filenames=$(ls "$@")
  for i in $filenames
  do
      while read item value
      do
          if [ $item="owner" ] || [ $item="admin" ] || [ $item="loc" ] || [ $item="ser"]
          then
              a[$item]=$value
          fi
      done &lt; i
  done
  
  echo '&lt;html&gt;'
  echo '&lt;body&gt;'
  echo '&lt;table border=1&gt;'
  echo '&lt;tr&gt;&lt;th&gt;hostname&lt;/th&gt;&lt;th&gt;location&lt;/th&gt;&lt;th&gt;Admin&lt;/th&gt;&lt;th&gt;Serial Number&lt;/th&gt;&lt;th&gt;owner&lt;/th&gt;&lt;tr&gt;'
  for i in filename
  do
      echo '&lt;tr&gt;&lt;td&gt;'$i'&lt;/td&gt;&lt;td&gt;'${i[loc]}'&lt;/td&gt;&lt;td&gt;${i[admin]}'&lt;/td&gt;&lt;td&gt;'${i[ser]}'&lt;/td&gt;&lt;td&gt;'${i[owner]}'&lt;/td&gt;&lt;tr&gt;'
  done
  echo 
  echo '&lt;/table&gt;'
  echo '&lt;/body&gt;'
  echo '&lt;/html&gt;'
  </code></pre>
  
  <p>The HTML isn't my main concern since I am just following a format given, with each of the values going in between. However, I am getting an error that I have no idea why:</p>
  
  <pre><code>invrep: line 10: i: no such file or directory
  </code></pre>
  
  <p>but I am using it in a loop. Why is it giving me this error?</p>
  
  <p>Also to confirm, the directory that I used exists; I'm not sure if that has to do with anything though.</p>