bash设置环境变量
How to set an environment variable in bash?
如何在bash中设置环境变量?
The syntax in bash for setting an environment variable is as follows.
bash中用于设置环境变量的语法如下。
export VARIABLE=value
Note that there is no space among the variable, the equals sign (“=”) and the value. If the value has spaces, the value should be put in quotes.
请注意,变量,等号(“ =”)和值之间没有空格 。 如果该值包含空格,则该值应放在引号中。
To check it:
要检查它:
echo $VARIABLE
To show all environment variables set, run env, set (bash build-in command) or printenv.
要显示所有设置的环境变量,请运行env ,set( bash内置命令 )或printenv 。
To make the variable settings effect for each bash shell, put the exporting command to your ~/.bashrc
, the individual per-interactive-shell startup file.
要使每个bash shell的变量设置生效,请将exporting 命令放入~/.bashrc
(每个单独的交互式shell启动文件)中。
翻译自: https://www.systutorials.com/how-to-set-an-environment-variable-in-bash/
bash设置环境变量