linux的环境变量怎么设置?
在/etc/profile下的什么位置下加入JAVA_HOME=...
export JAVA_HOME
呀!
我加了,可是每次重开shell后都要source profile才有效!
到底怎么设置呀!
有没有一次搞定的办法呀? :shock: 怎不在 ~/.bash_profile 設置?
我的 samples
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
JAVA_HOME=/usr/local/jre1.5.0_04
export JAVA_HOME
JAVA_BIN=$JAVA_HOME/bin
export JAVA_BIN
CLASSPATH=$CLASSPATH:$JAVA_HOME:$JAVA_HOME/lib
PATH=$JAVA_BIN:$PATH:$HOME/bin:/usr/local/Acrobat5/bin
export PATH CLASSPATH
unset USERNAME
export NNTPSERVER="freenews.netfront.net" 不太可能,因为在系统启动的时候,/etc/profile是要被系统执行的。 Whenbash is invoked as an interactive login shell, or as a non-inter-
active shell with the --login option, it first reads and executescom-
mandsfromthe file /etc/profile, if that file exists.After reading
that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile,
inthat order, and reads and executes commands from the first one that
exists and is readable.The --noprofile option may beusedwhenthe
shell is started to inhibit this behavior. 不错,/etc/profile是首先被执行的,检查你的拼写是否有误!
页:
[1]