PATH 应该加在哪里

PATH、LD_LIBRARY_PATH等最好加在.profile/.bashr_profile下,而不是.bashrc下。

因为.bashrc只对当前shell程序有效,而其他新建的shell程序(Terminal)都不会读取这个文件中的变量。

https://unix.stackexchange.com/questions/26047/how-to-correctly-add-a-path-to-path

即,如果想对全session有效,则加载.profile/.bashr_profile下。

如果是临时的,对当前shell,则可以临时加在.bashrc下

猜你喜欢

转载自www.cnblogs.com/simpleminds/p/12653800.html