我正在运行一个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中做什么才能让它工作?
export
是一个shell功能,而不是外部程序。要在其环境中运行具有特定值的程序,您可以改为使用env
。
env http_proxy=http://proxy.url.com:8099 aws s3 ls