stage ('Deploy')
{ sh """#!/usr/bin/expect set test [pwd] echo "$test" }
produces
groovy.lang.MissingPropertyException: No such property: test for class: groovy.lang.Binding
at groovy.lang.Binding.getVariable(Binding.java:63)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:264)
at org.kohsuke.groovy.sandbox.impl.Checker$6.call(Checker.java:289)
....