Groovy shell脚本无法识别导出命令

问题描述 投票:0回答:1

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

export http_proxy=http://proxy.url.com:8099
aws s3 ls

但是我收到了这个错误:

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)

当我在bash中运行时,export命令工作正常,那么我应该在groovy中做什么才能让它工作?

bash macos groovy groovyshell
1个回答
1
投票

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

env http_proxy=http://proxy.url.com:8099 aws s3 ls
© www.soinside.com 2019 - 2024. All rights reserved.