title: unexpected token '.' when executing a shell command when changing file extension within groovy script
body: <p>I'm trying to run the following command within a .groovy script:</p>
  
  <pre><code>sh """#!/bin/bash -ex
      find .. -name "*.gcda" | \
      xargs -I {} sh -c 'file=${0}; echo "${file%.*}".gcno' {} | \
      xargs -I {} sh -c 'gcov {} -o "\$(dirname {})"' \\;
  """
  </code></pre>
  
  <p>Not the prettiest command, but I'm finding a list of <code>.gcda</code> file names, changing those strings to have <code>.gcno</code> extensions instead, and then finally running a command on the <code>.gcno</code> version of the filename. </p>
  
  <p>The error I get:</p>
  
  <pre><code>org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
  WorkflowScript: 92: unexpected token: . @ line 92, column 60.
     h -c 'file=${0}; echo "${file%.*}".gcno'
                                   ^
  
  1 error
  </code></pre>
  
  <p>This command works fine when I run it in the terminal, it just complains when I execute it in Jenkins. I tried escaping a few things but couldn't figure it out.</p>