简体   繁体   中英

Groovy shell script doesn't recognize export command

I'm running a groovy shell script where I'm trying to set the proxy before running the aws command:

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

But I'm getting this error:

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)

The export command works fine when I run it in bash so what should I do in groovy to get it to work?

export is a shell feature and not an external program. To run a program with a certain value in its environment, you can instead use env .

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM