其他分享
首页 > 其他分享> > .bashrc 添加点环境变量

.bashrc 添加点环境变量

作者:互联网

如果需要用系统上面安装好的软件环境,可以编辑自己的用户主目录下面的:

vi ~/.bashrc

添加:

if [ -s /etc/additional_environment_values ]
then
    . /etc/additional_environment_values
fi

我在文件 /etc/additional_environment_values 里面已经做了添加环境变量的操作:

ADDITIONAL_PATHS=(
"/opt/make-4.3/bin"
"/opt/openssl-1.1.1m/bin"
"/opt/m4-1.4.19/bin"
"/opt/autoconf-2.71/bin"
"/opt/gettext-0.21/bin"
"/opt/git-2.35.1/bin"
"/opt/curl-7.81.0/bin"
"/opt/libxml2-2.9.9/bin"
"/opt/sqlite-autoconf-3370200/bin"
"/opt/onig-6.9.7/bin"
"/opt/php7.4.16/bin"
"/opt/php7.4.16/sbin"
"/opt/nginx-1.20.2/sbin"
"/opt/cmake-3.22.2/bin"
"/opt/pcre2-10.39/bin"
"/opt/pcre-8.45/bin"
"/opt/java-se-8u41-ri/bin"
"/opt/mysql-8.0.17-linux-x86_64-minimal/bin"
"/opt/redis-5.0.7/bin"
"/opt/beanstalkd-1.12/bin"
"/opt/otp_src_24.2.1/bin"
"/opt/rabbitmq_server-3.9.13/sbin"
)
for additional_path in ${ADDITIONAL_PATHS[@]}
do
    if [ -z "$PATH" ]
    then
        PATH="${additional_path}"
    else
        PATH="${PATH}:${additional_path}"
    fi
done
export PATH=$PATH
unset ADDITIONAL_PATHS additional_path

export JAVA_HOME="/opt/java-se-8u41-ri"

标签:opt,bin,additional,bashrc,添加,path,PATH,环境变量,ADDITIONAL
来源: https://blog.csdn.net/sinat_35576477/article/details/123025666