.bashrc和.bash_profile的区别

   经常有人问我.bashrc和.bash_profile的区别,在这里把它写出来。

   .bash_profile是在登陆的时候才会执行的,它也可以叫做.bash_login,也就是说你在命令行再运行bash命令的时候是不会执行这个文件里面的命令的。

   而.bashrc恰好相反,是在执行子shell(sub-shell)的时候才会执行里面的命令。

   现在默认的.bash_profile大多都有这么一句:

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

所以登陆的时候也会执行到.bashrc里面的命令。

转载于:https://www.cnblogs.com/FrankTan/archive/2011/01/09/1931416.html

猜你喜欢

转载自blog.csdn.net/weixin_34356310/article/details/93907213