title: Shell script Syntax error: word unexpected (expecting "in")
body: <p>I'm writing a shell script to start a <code>Zookeeper</code> server and write logs in <code>zookeeper.out</code> <code>nohup</code> file, but when I try to start it, the following error appears: </p>
  
  <pre><code>&gt; : not foundh: 2: zookeeper.sh:
  : not foundh: 8: zookeeper.sh:
  : not foundh: 10: zookeeper.sh:
  ---- Starting Zookeeper ----
  : not foundh: 12: zookeeper.sh:
  : not foundh: 13: zookeeper.sh: }
  : not foundh: 14: zookeeper.sh:
  ---- Stopping Zookeeper ----
  : not foundh: 17: zookeeper.sh:
  : not foundh: 18: zookeeper.sh: }
  : not foundh: 19: zookeeper.sh:
  : not foundh: 21: zookeeper.sh: stop
  : not foundh: 22: zookeeper.sh: start
  : not foundh: 23: zookeeper.sh: }
  : not foundh: 24: zookeeper.sh:
  zookeeper.sh: 25: zookeeper.sh: Syntax error: word unexpected (expecting "in")
  </code></pre>
  
  <p>I can't seem to understand what I'm doing wrong.</p>
  
  <p>Script:</p>
  
  <pre><code> #!/bin/sh
  
      JAVA_HOME=""
      KAFKA_HOME="/home/ubuntu/maxFlow/kafka_2.12-1.1.0"
      APP_HOME="/home/ubuntu/maxFlow/"
      APP_NAME=max-flow-0.0.1-SNAPSHOT
      APP_PORT=80
  
      start() {
  
          echo "---- Starting Zookeeper ----"
  nohup $KAFKA_HOME/bin/zookeeper-server-start.sh $KAFKA_HOME/config/zookeeper.properties &gt; /dev/null 2&gt;&amp;1 &amp; &gt; zookeeper.out
      }
  
      stop() {
           echo "---- Stopping Zookeeper ----"
           nohup $KAFKA_HOME/bin/zookeeper-server-stop.sh  &gt; /dev/null 2&gt;&amp;1 &amp; &gt; zookeeper.out
      }
  
      restart() {
               stop
               start
      }
  
      case "$1" in
        start)
              start
              ;;
        stop)
              stop
              ;;
        restart)
              stop
              start
              ;;
        *)
              echo "No case"
              exit 1
              ;;
      esac
  
      exit 0;
  </code></pre>
  
  <p>I took the syntax for the script from <code>https://www.shellscript.sh/case.html</code>. Thank you</p>