title: Jenkins shell script unexpected end of file
body: <p>I started a new <code>Jenkins</code> server in the following way using <code>Docker</code>:</p>
  
  <pre><code>$ docker run -p 8081:8080 -p 50000:50000 -v "${PWD}"/jenkins:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock -d --name jenkins jenkins/jenkins:lts
  </code></pre>
  
  <p>I want to use it for a simple pipeline executing a shell script that is building another Docker container. This is why I am mounting the <code>docker.sock</code> as well. However, using a Jenkinsfile like the following:</p>
  
  <pre><code>pipeline {
      agent any
  
      stages {
          stage('Build') {
              steps {
                  echo "####### builds: #######"
                  sh "(exit 1) || true # whatever I write here, it always fails"
              }
          }
      }
  }
  </code></pre>
  
  <p>I always get an error like:</p>
  
  <pre><code>Print Message -- ####### builds: ####### -- (self time 7ms)
  ####### builds: ####### 
  
  Shell Script -- (exit 1) || true -- (self time 18s)
  [X's Pipeline] Running shell script sh: 1: Syntax error: end of file unexpected (expecting "done")
  process apparently never started in /var/jenkins_home/workspace/X's Pipeline@tmp/durable-f294beff 
  </code></pre>
  
  <p>replacing the <code>sh</code> line by any of the following did produce a similar error message and lead the build process to fail as well:</p>
  
  <ul>
  <li><code>sh "pwd;"</code></li>
  <li><code>sh "echo 'hello';"</code></li>
  <li><code>sh ./build.sh;"</code></li>
  <li><p>​</p>
  
  <pre><code>sh ```
  #!/bin/sh
  echo hello
  ```
  </code></pre></li>
  <li>… I tried many more</li>
  </ul>
  
  <p>But when I remove the <code>sh</code> line, the build succeeds.
  I have successfully done this before on other systems. Is there anything I am missing here? </p>
  
  <hr>
  
  <pre><code>  Operating System: CentOS Linux 7 (Core)
         CPE OS Name: cpe:/o:centos:centos:7
              Kernel: Linux 3.10.0-514.26.2.el7.x86_64
        Architecture: x86-64
  
      Docker version: 17.05.0-ce, build 89658be
  </code></pre>