title: Syntax error: "fi" unexpected (expecting "then") in bash script
body: <p>I try to do the script:</p>
  
  <pre><code>#!/bin/bash
  IP='192.168.1.1'
  fping -c1 -t300 $IP 2&gt;/dev/null 1&gt;/dev/null
  if [ "$?" = 0 ]
  then
      echo "Host found"
  else
      echo "Host not found"
  fi
  </code></pre>
  
  <p>and i turn it:</p>
  
  <pre><code>pi@raspberrypi ~ $ sh /home/pi/sh/test.sh
  
  /home/pi/sh/test.sh: 9: /home/pi/sh/test.sh: Syntax error: "fi" unexpected (expecting "then")
  </code></pre>
  
  <p>where is the problem?</p>