自己记录的profile的写法

发布时间 2023-11-06 00:44:12作者: Mrzxs
uzls01@uzls01:~$ cat /etc/profile
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "${PS1-}" ]; then
  if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
    # The file bash.bashrc already sets the default PS1.
    # PS1='\h:\w\$ '
    if [ -f /etc/bash.bashrc ]; then
      . /etc/bash.bashrc
    fi
  else
    if [ "$(id -u)" -eq 0 ]; then
      PS1='# '
    else
      PS1='$ '
    fi
  fi
fi

if [ -d /etc/profile.d ]; then
  for i in /etc/profile.d/*.sh; do
    if [ -r $i ]; then
      . $i
    fi
  done
  unset i
fi

#set java environment
JAVA_HOME=/home/uzls01/opt/jdk1.8.0_341
JRE_HOME=$JAVA_HOME/jre 
CLASSPATH=:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
#也可以写成CLASSPATH=:$JAVA_HOME/lib:$JAVA_HOME/lib:$JRE_HOME/lib

#tomcat env
CATALINA_HOME=/home/uzls01/opt/tomcat8.5.82

#maven env
M2_HOME=/home/uzls01/opt/maven3.6.3

#nodejs_env
NODE_HOME=/home/uzls01/opt/node-v10.24.1-linux-x64

PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin:$CATALINA_HOME/bin:$M2_HOME/bin:$NODE_HOME/bin

export JAVA_HOME JRE_HOME PATH CLASSPATH  CATALINA_HOME M2_HOME NODE_HOME

uzls01@uzls01:~$