Home > other >  What is "delimited by end-of-file (wanted `EOF')"
What is "delimited by end-of-file (wanted `EOF')"

Time:07-26

I am trying to execute following lines-

   sh """
      #!/bin/bash
      cd ${WORKSPACE}

      cat << EOF > build.sh
      #!/bin/bash
      mkdir wsbuildlinux
      cd wsbuildlinux
      cmake3 ../../wiresharkbuild_linux
      make
      EOF

      chmod 755 build.sh

      # run container and build wireshark
      ./build-env/run-wireshark-env ./build.sh
    """

and here is the content of "build.sh"-

  #!/bin/bash
  mkdir wsbuildlinux
  cd wsbuildlinux
  cmake3 ../../wiresharkbuild_linux
  make
  EOF

  chmod 755 build.sh

  # run container and build wireshark
  ./build-env/run-wireshark-env ./build.sh

But I keep getting following error-

/opt/cvsdirs/crdbuilds/jenkins/slave/workspace/Wireshark_Wireshark_trunk@tmp/durable-f510f070/script.sh: line 17: warning: here-document at line 5 delimited by end-of-file (wanted `EOF')

I have no idea what this error means and how to resolve it. Could you please give some advice on this

CodePudding user response:

The EOF token has to be at the beginning of the line.

sh """
      #!/bin/bash
      cd ${WORKSPACE}

      cat << EOF > build.sh
      #!/bin/bash
      mkdir wsbuildlinux
      cd wsbuildlinux
      cmake3 ../../wiresharkbuild_linux
      make
EOF

      chmod 755 build.sh

      # run container and build wireshark
      ./build-env/run-wireshark-env ./build.sh
    """
  • Related