Answers: <p>Apparently this was caused by the pipeline name having an apostrophe character in it. Renaming the build solved the issue.</p>
  
Answers: CC BY-SA 4.0
Answers: 2018-06-22T14:17:34.427Z
Answers: 2018-06-22T14:17:34.427Z
Answers: Sebastian Lenartowicz
Body: <p>I've been experimenting with creating a new pipeline, using the built-in pipeline editor (i.e. not from SCM). The strange bit is that, when I run <em>any</em> <code>sh</code> step, I receive the following error:</p>
  
  <blockquote>
    <p>sh: 1: Syntax error: end of file unexpected (expecting "done")</p>
  </blockquote>
  
  <p>This comes from the following MWE:</p>
  
  <pre><code>pipeline {
      agent any
  
      stages {
          stage('Test') {
              steps {
                  sh 'echo "FOO!"'
              }
          }
      }
  }
  </code></pre>
  
  <p>The odd bit is that my pipeline scripts that <em>are</em> coming from SCM are working just fine, despite the fact that they have loads of shell scripts.</p>
  
  <p>Running Jenkins 2.73.2.</p>
  
Tags: <jenkins><jenkins-pipeline>
Title: Jenkins "internal" pipeline script producing errors when running sh steps
UserDisplayName: Sebastian Lenartowicz
ThreadText: # Jenkins "internal" pipeline script producing errors when running sh steps
  
  (Asked by: username_0 on 2018-06-22)
  
  I've been experimenting with creating a new pipeline, using the built-in pipeline editor (i.e. not from SCM). The strange bit is that, when I run *any* `sh` step, I receive the following error:
  
  > sh: 1: Syntax error: end of file unexpected (expecting "done")
  
  This comes from the following MWE:
  
  ```
  pipeline {
      agent any
  
      stages {
          stage('Test') {
              steps {
                  sh 'echo "FOO!"'
              }
          }
      }
  }
  
  ```
  
  The odd bit is that my pipeline scripts that *are* coming from SCM are working just fine, despite the fact that they have loads of shell scripts.
  
  Running Jenkins 2.73.2.
  
  **Tags:** jenkins, jenkins-pipeline
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-06-22. Score: 2 | Accepted answer
  
  Apparently this was caused by the pipeline name having an apostrophe character in it. Renaming the build solved the issue.
  
  
  ---
  
  