Bash Groovy shell脚本无法识别export命令

Bash Groovy shell脚本无法识别export命令,bash,macos,groovy,groovyshell,Bash,Macos,Groovy,Groovyshell,我正在运行groovy shell脚本,在运行aws命令之前尝试设置代理: 但我得到了一个错误: Caught: java.io.IOException: Cannot run program "export": error=2, No such file or directory java.io.IOException: Cannot run program "export": error=2, No such file or directory at com.capitalone.c

我正在运行groovy shell脚本,在运行aws命令之前尝试设置代理:

但我得到了一个错误:

Caught: java.io.IOException: Cannot run program "export": error=2, No such file or directory
java.io.IOException: Cannot run program "export": error=2, No such file or directory
    at com.capitalone.cep.lensOps.run(lensOps.groovy:13)
export命令在bash中运行时可以正常工作,那么在groovy中应该怎么做才能让它工作呢?

export是一个shell功能,而不是一个外部程序。要在其环境中运行具有特定值的程序,可以改用env

Caught: java.io.IOException: Cannot run program "export": error=2, No such file or directory
java.io.IOException: Cannot run program "export": error=2, No such file or directory
    at com.capitalone.cep.lensOps.run(lensOps.groovy:13)
env http_proxy=http://proxy.url.com:8099 aws s3 ls