title: How to load bash script in Jenkins pipeline?
body: <p>We have some complex bash script which is now in our managed files section in Jenkins. We try to migrate the job to a pipeline but we don't know enough to translate the bash script to groovy so we want to keep this in bash.
  We have a jenkins-shared-library in Git in which we store our pipeline templates. Inside the job we add the right environment variables.</p>
  
  <p>We want to keep our bash script in git instead of in the managed files. What is the right way to load this script in the pipeline and execute it?
  We tried some stuff with <code>libraryResource</code>, but we didn't manage to make it work. Where do we have to put the <code>test.sh</code> script in git and how can we call it? (or is it completely wrong to run a shell script here)</p>
  
  <pre><code>def call(body) {
      // evaluate the body block, and collect configuration into the object
      def pipelineParams= [:]
      body.resolveStrategy = Closure.DELEGATE_FIRST
      body.delegate = pipelineParams
      body()
  
      pipeline {
          agent any
  
          options {
              buildDiscarder(logRotator(numToKeepStr: '3'))
          }
  
          stages {
  
              stage ('ExecuteTestScript') {
                  steps {
                      def script = libraryResource 'loadtestscript?'
  
                      script {
                          sh './test.sh'
                      }
                  }
              }
  
          }
  
          post {
              always {
                  cleanWs()
              }
  
          }
  
      }
  }
  </code></pre>