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

2022/8/24 6:54:13

本文主要是介绍解决.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



这篇关于解决.bashrc文件每次打开终端都需要source的问题的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程