.bashrc和.bash_profile的区别
2011-01-09 20:48
232 查看
经常有人问我.bashrc和.bash_profile的区别,在这里把它写出来。
.bash_profile是在登陆的时候才会执行的,它也可以叫做.bash_login,也就是说你在命令行再运行bash命令的时候是不会执行这个文件里面的命令的。
而.bashrc恰好相反,是在执行子shell(sub-shell)的时候才会执行里面的命令。
现在默认的.bash_profile大多都有这么一句:
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
所以登陆的时候也会执行到.bashrc里面的命令。
.bash_profile是在登陆的时候才会执行的,它也可以叫做.bash_login,也就是说你在命令行再运行bash命令的时候是不会执行这个文件里面的命令的。
而.bashrc恰好相反,是在执行子shell(sub-shell)的时候才会执行里面的命令。
现在默认的.bash_profile大多都有这么一句:
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
所以登陆的时候也会执行到.bashrc里面的命令。
相关文章推荐
- Linux中profile、bashrc、bash_profile之间的区别和联系
- .bash_profile和.bashrc的什么区别
- 【.bash_profile 与 .bashrc 的区别】
- Linux bash_profile和.bashrc以及profile的区别
- /etc/profile /etc/bashrc .bashrc .bash_profile的区别
- bash_profile和.bashrc的什么区别
- Linux: .bash_profile和.bashrc的区别
- Linux中profile、bashrc、bash_profile之间的区别和联系
- Linux中profile、bashrc、bash_profile之间的区别和联系
- Linux中profile、bashrc、bash_profile之间的区别和联系
- bash_profile和.bashrc的什么区别
- .bash_profile和.bashrc的什么区别,linux的几个环境配置文件的区别
- Linux中profile、bashrc、bash_profile之间的区别和联系
- Linux下/etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc的区别
- linux下 bash_profile和bashrc区别
- .bash_profile和.bashrc的什么区别
- Linux中profile、bashrc、bash_profile之间的区别和联系
- Linux中profile、bashrc、bash_profile之间的区别和联系
- .bash_profile和.bashrc的区别(如何设置生效)
- .bash_profile和.bashrc的区别(如何设置生效)