.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"

你可能感兴趣的:(IT技术相关,linux,后端,运维,自动化)