如何设置一个bash命令多个ENV变量 [英] How set multiple env variables for a bash command

查看:160
本文介绍了如何设置一个bash命令多个ENV变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该设置EC2_HOME和JAVA_HOME变量
运行命令之前(EC2-描述区域)

I am supposed to set the EC2_HOME and JAVA_HOME variables before running a command (ec2-describe-regions)

我怎么,在一个去了?

推荐答案

您可以一次性设置通过将它们在命令行命令之前瓦尔单个命令:

You can one-time set vars for a single command by putting them on the command line before the command:

$ EC2_HOME=/path/to/dir JAVA_HOME=/other/path ec2-describe-regions

另外,也可以导出它们的环境,在这种情况下,他们会为未来的所有命令进行设置:

Alternately, you can export them in the environment, in which case they'll be set for all future commands:

$ export EC2_HOME=/path/to/dir
$ export JAVA_HOME=/other/path
$ ec2-describe-regions

这篇关于如何设置一个bash命令多个ENV变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆