|
|
与环境变量相关的文件:1,etc/profile2 , etc/profile.d/*.sh3 , etc/bashrc4 , ~/.bash_profile (ps:ubuntu下文件名为~/.profile)5 , ~/.bashrc其中4,5 在家目录下的文件只对当前用户有效,etc文件夹下的对所有用户有效。添加环境变量:export 变量名=变量值 (例:export LD_LIBRARY_PATH=/home/other/test/lib LD_LIBRARY_PATH )但是这样只能临时生效,重启就要重设。想永久生效:1 cd #回到当前用户家目录2 vim .bash_profile (ps:ubuntu下文件名为~/.profile)3 在bash_profile文件末尾添加并保存以下命令:export 变量名=变量值 #注意等号两边不能有空格 4 source .bash_profile #立即生效 |
|