title: if then else statement inside a loop with variable files name sample
body: <p>What am I doing wrong with this sample code?</p>
  <pre><code>for HOSTNAME in $(cat hostnames.txt)
  do
          file =&quot;/path/$HOSTNAME.crt&quot;
          if [[-e &quot;$file&quot;]]
          then
                  echo &quot;file exist&quot;
          else
                  echo &quot;file dose NOT Exist&quot;
          fi
  done
  </code></pre>
  <p>ERROR:</p>
  <pre class="lang-none prettyprint-override"><code>=/path/ad.tc.crt: cannot open ‘=/path/ad.tc.crt’ (No such file or directory)
  ./certs_check.sh: line 15: [[-e: command not found
  file dose NOT Exist
  =/path/cpscom.ds.crt: cannot open `=/path/cpscom.ds.crt' (No such file or directory)
  ./certs_check.sh: line 15: [[-e: command not found
  file dose NOT Exist
  </code></pre>
  <p>The first file <code>/path/ad.tc.crt</code> exists so it should print &quot;file does exist&quot;.</p>