In your case you just need to escape \$VERSION to avoid the GString to be interpolated.
sh "find packages -name internal-* -type d -exec bash -c 'for arg; do export VERSION=\$(grep \${arg##*/} nexus-cicd-versions.txt | cut -d: -f2);sed -i \'s/#VERSION#/\${VERSION}/g\' \$arg/0/package.json; done' _ {} +" But again, GString might be a bit tricky when escaping in the sh step within the jenkins pipeline Cheers -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/d5f99355-7fa1-4b8c-b6b0-8fa9fd74025f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.