当我登录太阳箱时:SunOS domain.com 5.8 Generic_117350-57 sun4u sparc SUNW,Sun-Fire-V240
我从sh shell开始:SHELL = / bin / sh
我输入bash来启动bash shell,然后必须输入。 .bash_profile加载我的个人资料。有没有办法可以设置为自动加载配置文件?
答案 0 :(得分:2)
把
。 〜/ .bash_profile中
>在〜/ .bashrc中(注意无限循环!)。我不会自己使用它,因为我在.bashrc中有大多数东西开始(除了,以及env。等等)。答案 1 :(得分:1)
.bash_profile
仅用于登录shell,对于非登录shell(如你的),bash使用.bashrc
。
最简单的方法是将. .bash_profile
添加到.bashrc
。
您还必须确保不在非交互式shell中打印任何内容,或者您可以破坏scp / sftp。
答案 2 :(得分:1)
像这样运行 bash 会导致它来源 /etc/bash.bashrc 然后〜/ .bashrc 来代替 .bash_profile (和其他文件)。因此,将. ~/.bash_profile
放在〜/ .bashrc 中,(或在 /etc/bash.bashrc 中为所有用户执行此操作)。
答案 3 :(得分:0)
登录时运行文件.bash_profile
。从非登录会话运行bash时运行文件.bashrc
。
尝试将此添加到您的.bashrc
:
source ~/.bash_profile