在shell中設置環境變量可以使用export命令,例如:
export
export MY_VARIABLE=value
要使環境變量即時生效,可以使用以下命令:
source ~/.bashrc
這將重新加載當前shell的配置文件(通常是.bashrc或.bash_profile),使新設置的環境變量立即生效。
.bashrc
.bash_profile