解决.bashrc文件每次打开终端都需要source的问题

解决方法

配置~/.bash_profile

vi ~/.bash_profile
if [ -f ~/.bashrc ] ; then
   source  ~/.bashrc
fi 

到这里,退出会话,重新登陆ssh,基本就可以解决每次登陆ssh后都要输入source ~/.bashrc命令的问题了, 如果还没有解决,继续配置~/.bashrc

配置~/.bashrc

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

说明

配置文件的执行顺序为:/etc/profile→ (~/.bash_profile | ~/.bash_login | /.profile)→/.bashrc →/etc/bashrc → ~/.bash_logout

posted @ 2022-08-24 00:18  iminifly  阅读(586)  评论(0编辑  收藏  举报