title: Running a Bash script with correct syntax but it keeps giving me a syntax error
body: <p>I have been trying to compile my Bash script but I keep getting this syntax error even though I'm following the correct syntax. </p>
  
  <p>Code: </p>
  
  <pre><code>    #!/bin/sh
  set -u
  SERVICE_NAME=Server
  PATH_TO_JAR=/usr/local/MyProject/MyJar.jar
  PID_PATH_NAME=/tmp/Server-pid
  case $1 in
      start)
          echo "Starting $SERVICE_NAME ..."
          if [ ! -f "$PID_PATH_NAME" ]; then
               nohup java -cp '/home/ubuntu/ResumeParser/ResumeParser/ResumeTransducerbin/* :/home/ubuntu/ResumeParser/ResumeParser/GATEFiles/lib/*:/home/ubuntu/.../ServerTest' /tmp 2&gt;&gt; /dev/null &gt;&gt; /dev/null &amp;
                          echo $! &gt; $PID_PATH_NAME
              echo "$SERVICE_NAME started ..."
          else
              echo "$SERVICE_NAME is already running ..."
          fi
      ;;
      stop)
          if [ -f $PID_PATH_NAME ]; then
              PID=$(cat $PID_PATH_NAME);
              echo "$SERVICE_NAME stoping ..."
              kill $PID;
              echo "$SERVICE_NAME stopped ..."
              rm $PID_PATH_NAME
          else
              echo "$SERVICE_NAME is not running ..."
          fi
      ;;
      restart)
          if [ -f $PID_PATH_NAME ]; then
              PID=$(cat $PID_PATH_NAME);
              echo "$SERVICE_NAME stopping ...";
              kill $PID;
              echo "$SERVICE_NAME stopped ...";
              rm $PID_PATH_NAME
              echo "$SERVICE_NAME starting ..."
              nohup java -cp '/home/ubuntu/ResumeParser/ResumeParser/ResumeTransducerbin/*:/home/ubuntu/... ServerTest' /tmp 2&gt;&gt; /dev/null &gt;&gt; /dev/null &amp;
                          echo $! &gt; $PID_PATH_NAME
              echo "$SERVICE_NAME started ..."
          else
              echo "$SERVICE_NAME is not running ..."
          fi
      ;;
  esac
   
  </code></pre>
  
  <p>When I run: sudo service Server start </p>
  
  <pre><code>    /etc/init.d/Server: 9: /etc/init.d/Server: Syntax error: "then" unexpected     (expecting ";;")
  </code></pre>
  
  <p>When I run: bash -n Server</p>
  
  <pre><code>Server: line 9: syntax error near unexpected token `then'
  Server: line 9: `        if [ ! -f $PID_PATH_NAME ]; then'
  </code></pre>
  
  <p>What am I doing wrong?</p>