51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

linux 每次登陆时都需要 source ~/.bashrc 的问题

目录

问题 {#i}

最近安装mysql,cmake,可能是修改了 ~ /.bash_profie 配置文件,导致每次登录服务器都需要source ~/.bashrc以激活环境变量,才可以执行如ls 等的基本操作

解决方法1:配置~/.bash_profile {#1bash_profile}

vi ~/.bash_profie
查看是否有以下代码,加入代码后如下所示:

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ] ; then
        source .bashrc
fi

source ~/.bash_profile
关闭Xshell, 重新打开一个窗口,发现问题已解决。

解决方法2:配置~/.bashrc {#2bashrc}

vi ~/.bashrc

写入以下内容:

if [ -f /etc/bashrc ] ; then
   source .bashrc
fi 

原文:

https://www.jianshu.com/p/395bc4a939a8

https://www.cnblogs.com/iminifly/p/16618365.html


赞(1)
未经允许不得转载:工具盒子 » linux 每次登陆时都需要 source ~/.bashrc 的问题