I have below code.The logic here is if HostList conatains any blanck entry it should set class as blank, else it should be red.Now I am getting error-
test.sh[3]: syntax error at line 7 : `then' unexpected
can any one help me out?Thanks!!
     #! /bin/bash
file=./HostList.txt
{
  echo "<table>"
  printf "<tr>"
  if[%s -eq =""]; then
      class="blank"
  else
    class="red"
  fi    
    "<td" $class">%s</td>
    <td>%s</td>
    <td>%s</td>
    <td>%s</td>
    <td>%s</td>
    <td>%s</td>
    <td>%s</td>
    <td>%s</td>
    <td>%s</td>
    <td>%s</td>
    <td>%s</td>
    <td>%s</td>
    <td>%s</td>
    </tr>\n" $(cat "$file"|cut -d'.' -f1)
  echo "</table>"
}  > table.html
exit 0
 
     
     
     
    