title: catch problems with -ne in bash?
body: <p>Running the code below gives me the error</p>
  
  <pre><code>-bash: [: -ne: unary operator expected
  </code></pre>
  
  <p>res is =="". But i thought -ne will compare a string to int. When i do get errors its the above instead of what i want which is the domain name and curls output (its silenced in the first call because it will put junk on stdout). How do i execute the if body?</p>
  
  <pre><code>#!/bin/sh
  function test {
      res=`curl -I $1 | grep HTTP/1.1 | awk {'print $2'}`
      if [ $res -ne 200 ]
      then
          echo "Error on $1"
          curl -I $1
      fi
  }
  
  test invalidsite.hsdgsdhfgsgdfysgdfgsdfygsyd.com
  </code></pre>