2005-07-04

.bashrc 文件

系里机房里的机器安装的是Debian,用户默认的Shell是tch。由于没有历史功能,所以我把自己的默认Shell改为了bash,并在.bashrc文件里重新定义了ls命令的别名。可是发现当每次登录进入时,系统总是找不到自己定义的别名命令,得执行source .bashrc后才能使用自定义的别名。

察看了一下man手册,才知道在Login时是不会执行.bashrc的,而是执行.bash_profile。在O'reilly的"Learning Debian GNU/Linux"书中解释如下:
/etc/profile: Executed when the user logs in
~/.profile: Executed when the user logs in
~/.bashrc: Executed when BASH is launched
~/.bash_logout: Executed when the user logs out

我在我的home目录下生成了.bash_profile文件并包含了:
#!/bin/bash
source .bashrc

问题解决了!

没有评论:

发表评论