解决Linux服务器SSH后不执行.bashrc命令

解决办法

因为每次连接,Linux默认都会执行~/.bash_profile,

所以我们可以在~/.bash_profile文件内添加以下脚本:

if [ -n "$BASH_VERSION" ]; then  
    # include .bashrc if it exists  
    if [ -f "$HOME/.bashrc" ]; then  
        . "$HOME/.bashrc"  
    fi  
fi  

 

 

图示

解决Linux服务器SSH后不执行.bashrc命令

 

 

相关

ssh linux bashrc 总是没掉

解决ssh连入linux服务器~/.bashrc不执行的方法